How to stop gunicorn/nginx from serving up the default project on ubuntu/django droplet?

June 17, 2014 4.8k views
I am working through this tutorial (and those linked from it) https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn I have my own 'hello world' django project that I've pulled onto the droplet using git. I went to configure gunicorn/nginx as per the tutorial, but I realised these are already running, serving up the django_project default that comes with the pre-configured django droplet. I did a pkill gunicorn, but it starts back up again as soon as I kill the processes. Is supervisord (or similiar) already running? How do I remove all trace of the django_project from the droplet to allow me to get my own project running?
1 Answer
On the Django one-click install image, the gunicorn process is being run via Upstart which will restart it if it's killed. So you need to run:
service gunicorn stop
in order to stop it completely. To serve your own Django project, there are two key files that you need to change to remove references to django_project. In /etc/init/gunicorn.conf you need to change the name and the pythonpath to match your new project. In /etc/nginx/sites-enabled/django, you need to change the paths to both your media and static files to match your new location. See this article for more details on the configuration files: https://www.digitalocean.com/community/tutorials/how-to-use-the-django-one-click-install-image
Have another answer? Share your knowledge.