Running Ubunto 22, I installed pymongo, added import pymongo to myproject.py .If I run myproject.py using python3 myproject.py no issues. If I sudo systemctl restart myproject, I get a 502 bad gateway error. Any clues? Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Click below to sign up and get $200 of credit to try our products over 60 days!
Check your logs, what does Nginx say other than 502 bad gateway? Additionally, check your application’s log, do you see anything there? it’s important to have access to logs. By default, Gunicorn logs errors and warnings. You can configure Gunicorn logging to get more information, including access logs.
Here are a few steps to enable and manage Gunicorn logging:
Update your gunicorn configuration:
In your gunicorn service file
/etc/systemd/system/gunicorn.service, update the
ExecStartline to include log file paths for access and error logs. Replace the following line:
Make sure to replace
/path/to/your/error.logwith the desired paths for your log files.
--log-levelflag can be set to different values, depending on the level of detail you want in your logs:
After updating the configuration, restart the gunicorn service for the changes to take effect: