I am currently trying to set up my django website on ec2. If I run
gunicorn --bind 0.0.0.0:8000 website.wsgi:application
the website runs as long as I specify port 8000 at the end of the URL. I do not want to have to do this so my end goal is to use nginx. I created my gunicorn.service file via the following command:
sudo nano /etc/systemd/system/gunicorn.service
Its contents are as follows:
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=home/ubuntu/Fantasy-Fire/website
ExecStart=/home/ubuntu/env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/ubuntu/Fantasy-Fire/website/website.sock website.wsgi:application
[Install]
WantedBy=multi-user.target
When I run
sudo systemctl start gunicorn
I get the following error:
Failed to start gunicorn.service: Unit gunicorn.service is not loaded properly: Exec format error.
See system logs and 'systemctl status gunicorn.service' for details.
The details given via the gunicorn.service are
Nov 29 04:34:13 ip-172-31-27-152 systemd[1]: /etc/systemd/system/gunicorn.service:8: Working directory path 'home/ubuntu/Fantasy-Fire/website' is not absolute.
I am pretty certain the file path is absolute so I can't seem to find what the issue is. Please let me know if you need any info about my file structure.