Question

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

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?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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: <pre> service gunicorn stop </pre> 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 <code>django_project</code>. In <code>/etc/init/gunicorn.conf</code> you need to change the name and the pythonpath to match your new project. In <code>/etc/nginx/sites-enabled/django</code>, 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