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

June 17, 2014 3.3k views
I am working through this tutorial (and those linked from it) 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:
by Andrew SB
Django is a high-level Python framework for developing web applications rapidly. DigitalOcean's Django One-Click app quickly deploys a preconfigured development environment to your VPS employing Django, Nginx, Gunicorn, and Postgres.
Have another answer? Share your knowledge.