1

My django app is running on an nginx/uwsgi stack. My goal is to start a python script which runs independently from the web server. By hitting a endpoint on django, it would thus fire off a non blocking script.

I've looked into using python subprocess/Popen - i'm just not sure if the script is still running on the web server or not via subprocess.Popen()

2
  • You could use Twisted, but you'd have to do a bit of wizardry with the Crochet library. It really depends on what you're trying to do. But if you're simply trying to run a script in a different process, you can just use Multiprocessing. Commented Apr 6, 2015 at 19:53
  • Well, you could use celery.readthedocs.org/en/latest, that integrates nicely with Django. The asynchronous task would then run the background, and commit its potential result to a backend. Commented Apr 6, 2015 at 19:59

1 Answer 1

3

This is exactly what Celery is for. You should use that.

Sign up to request clarification or add additional context in comments.

2 Comments

So celery can run background tasks that wont die even if a uwsgi process serving django is running on dies?
After some doc reading - I didn't realize celery was separately daemonized, thus exactly what I needed. When using uwsgi however, I did find their Mules concept to be on par with celery.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.