Question
How to deploy multiple Django apps (as subdomains) using nginx and Gunicorn
I have a new 18.04 Droplet running a Django website on nginx. I’d like to use this droplet to serve several websites at subdomains. I have successfully:
Followed this excellent tutorial to set up my first website: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04
Configured nginx and DNS to serve (static) websites & subdomains on this server
Set up a second Django app that I can run on port 8000, using Gunicorn as a console process
So where I’m hung up is what I add to the systemd
configuration? I tried copy/pasting the [Service]
block for my new site but when I try to restart gunicorn I get this error:
systemd[1]: gunicorn.service: Service has more than one ExecStart= setting, which is only allowed for Type=one
Should I create a second *.service
file in /etc/systemd/system/
? Is there some way to put multiple Django apps into one ExecStart directive? Each app runs in its own virtual environment.
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.
×