Deploying Django with Nginx as service

By : miki725

Currently I have a home server (Ubuntu) with nginx running where I use proxy pass in order to pass the requests to django. I am using gevent as my wsgi server.

It all works fine until the server shuts down either because I restart the server for whatever reason or something crashes (electricity). Since nginx is a service, when the server restarts, nginx starts up as well. However my django apps do not. So then I have to manually go to each of my django projects, activate their virtualenvs, and then fire up the gevent process. This is very annoying to say the least.

Is there a standard way of handling all of this automatically?

By : miki725


Consider using a process manager to handle this for you. I like supervisor

You tell it how to launch your various processes and then it runs in the background (just like nginx) and will automatically start up on restart and launch your various django backend processes.

This video can help you solving your question :)
By: admin