[Answer]-Managing a long running request to Django from Heroku

1đź‘Ť

Ha you’ve asked a pretty open ended question…Rather than rewrite a bunch of things that have already been written, let me try to point you in the right direction.s

A good standard for this is celery when using Django/Python. See https://devcenter.heroku.com/articles/celery-heroku#deploying-on-heroku for heroku details on the use. Once you get the initial setup, it’s as simple as decorating your async tasks with “@task”and calling them with “.delay()”.

You will need a “backing store” that is used to manage the tasks. The heroku guide runs you through redis. If you’ve got a database that’s underutilized and your rate of async tasks is very small, then you may want to run that in production. Otherwise I found the cheapest solution without performance worries has been Redis.

If you’re really light on your app consider using Honcho (see http://www.radekdostal.com/content/heroku-running-multiple-python-processes-single-dyno-using-honcho)

👤arosenber

Leave a comment