Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Setting up django on nginx, ran in error: "can't chdir to ..."
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
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.×