Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6025

Gunicorn not starting even after succesfully configuring all files

$
0
0

I am working on a particular Django project (Don't know if this makes a difference but the service provider is Hostinger).. The deployment of the same is to be done on a vps server with ubuntu in it. Using gunicorn and nginx is what I have planned , but I keep on running into

502 bad gateway errorOn poking around found that gunicorn is not starting

The following is the error received when I ran

sudo systemctl status gunicorn

Error :

× gunicorn.service - gunicorn daemon     Loaded: loaded (/etc/systemd/system/gunicorn.service; disabled; vendor preset: enabled)     Active: failed (Result: exit-code) since Tue 2024-01-02 07:53:47 UTC; 4 days agoTriggeredBy: ● gunicorn.socket   Main PID: 6153 (code=exited, status=203/EXEC)        CPU: 1msJan 02 07:53:47 srv457341 systemd[1]: Started gunicorn daemon.Jan 02 07:53:47 srv457341 systemd[6153]: gunicorn.service: Failed to execute /root/Assistanza/Assistanza/env/bin/gunicorn: No such file or directoryJan 02 07:53:47 srv457341 systemd[6153]: gunicorn.service: Failed at step EXEC spawning /root/Assistanza/Assistanza/env/bin/gunicorn: No such file or directoryJan 02 07:53:47 srv457341 systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXECJan 02 07:53:47 srv457341 systemd[1]: gunicorn.service: Failed with result 'exit-code'.Jan 02 07:53:47 srv457341 systemd[1]: gunicorn.service: Start request repeated too quickly.Jan 02 07:53:47 srv457341 systemd[1]: gunicorn.service: Failed with result 'exit-code'.Jan 02 07:53:47 srv457341 systemd[1]: Failed to start gunicorn daemon.

The following is my file structure :enter image description here

The path to this is :/root/Assistanza/Assistanza

The following is the service file of gunicorn:

[Unit]Description=gunicorn daemon                                                                                                                                             Requires=gunicorn.socket                                                                                                                                                After=network.target[Service]User=rootGroup=www-dataWorkingDirectory=/root/Assistanza/AssistanzaExecStart=/root/Assistanza/Assistanza/env/bin/gunicorn \          --access-logfile - \          --workers 3 \          --bind unix:/run/gunicorn.sock \          Assistanza.wsgi:application[Install]WantedBy=multi-user.target~                                                                                                                                                                       ~        

How do I solve this ?

Update : So the error was the gunicorn was not running right in the virtual environment. To solve this I installed a new virtual environment and then installed gunicorn in that and saw that which gunicorn gave me the path to the file/env/bin/gunicorn.

and changed the service file path to this new venv and all is working fine.


Viewing all articles
Browse latest Browse all 6025

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>