I am trying to get my gunicorn setup. Following is my config file for the systemmd config file:
# Unit section is used to specify metadata and dependencies
[Unit]
Description=DEMO
# only start once the network target has been reached
After=network.target
# Service section specify the user and group that we want the process to run under
[Service]
# www-data group assigned to facilitate easy communication with nginx
Group=www-data
# path to working directory
WorkingDirectory=/srv/demo/git
# path to virtual environment
Environment="PATH=/srv/demo/git/venv/bin"
ExecStart=/srv/demo/git/venv/bin/gunicorn --workers=5 --bind unix:git.sock --log-level=debug wsgi:app --timeout 3600
#--workers=5 --threads=2 --worker-class=gthread
[Install]
WantedBy=multi-user.target
~
~
~
And my virtual environment folder does contain gunicorn:
But I am still unable to run this, the systemmd file says that it was unable to find gunicorn. No such file or directory:
i have uninstall gunicorn from outside my virtual env. But when i do a which gunicorn it shows me the path to be /usr/bin/gunicorn. When i put this path, it dosnt throw the same error but simply says that the apt_pkg and gunicorn module wasnt found but not a directory error. Is this a path issue? If so how can i fix it?
I hope following steps will be helpful to solve this problem....
Step 1: cd ~/myprojectdir
Step 2: source myprojectenv/bin/activate
Step 3: which gunicorn
Step 4: Paste that into the path section of the 'ExecStart' value exchange '/etc/systemd/system/gunicorn.service' by which guicorn '..../path"
Step 5: sudo systemctl daemon-reload
Step 6: sudo systemctl restart gunicorn
Step 7: sudo systemctl status gunicorn
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.