I was following this tutorial: https://www.howtoforge.com/how-to-install-django-on-centos-8/ on how to set up django on nginx with gunicorn but ran into the following error:
[user@centos-s-1vcpu-2gb-fra1-01 ~]$ systemctl status django ● django.service - django daemon Loaded: loaded (/etc/systemd/system/django.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2020-09-02 19:44:16 UTC; 6s ago Process: 4615 ExecStart=/usr/local/bin/gunicorn --workers 3 --bind unix:/home/user/djangoprojects/djangoproject.sock djangoproject.wsgi:application (code=exited, status=1/FAILURE) Main PID: 4615 (code=exited, status=1/FAILURE) Sep 02 19:44:15 centos-s-1vcpu-2gb-fra1-01 systemd: Started django daemon. Sep 02 19:44:16 centos-s-1vcpu-2gb-fra1-01 gunicorn: Error: can't chdir to '/home/user/djangoprojects' Sep 02 19:44:16 centos-s-1vcpu-2gb-fra1-01 systemd: django.service: Main process exited, code=exited, status=1/FAILURE Sep 02 19:44:16 centos-s-1vcpu-2gb-fra1-01 systemd: django.service: Failed with result 'exit-code'.
Can someone help me out? I tried a lot of things and researched for a long time, but nothing helped.
Thats the service file:
[Unit] Description=django daemon After=network.target [Service] User=nginx Group=nginx WorkingDirectory=/home/user/djangoprojects/ ExecStart=/usr/local/bin/gunicorn --workers 3 --bind unix:/home/user/djangoprojects/djangoproject.sock djangoproject.wsgi:application [Install] WantedBy=multi-user.target
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!
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.
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.
Click below to sign up and get $100 of credit to try our products over 60 days!