DEV Community

Discussion on: Deploy Flask The Easy Way With Gunicorn and Nginx!

Collapse
 
brandonwallace profile image
brandon_wallace • Edited

It looks like you have put your project in the /root directory.

/root/status_report_automation/
Enter fullscreen mode Exit fullscreen mode

It is better to put it in /var/www/ like this:

$ sudo mkdir /var/www/status_report_automation/
Enter fullscreen mode Exit fullscreen mode

Then set the correct permissions on the directory and files.

$ sudo chown -R $USER:www-data /var/www/status_report_automation/
Enter fullscreen mode Exit fullscreen mode

Make sure your systemd service file looks something like this in the service section:

[Service]
User=YOUR_USER_NAME_GOES_HERE
Group=www-data
WorkingDirectory=/var/www/status_report_automation/
ExecStart=/var/www/status_report_automation/.venv/bin/gunicorn --workers 3 --bind unix:/var/www/status_report_automation/status_report_automation.sock wsgi:app
Enter fullscreen mode Exit fullscreen mode