gunicorn - python

Logging

When logging prints you must use flush=True as in: # Not sure why this happens or how to fix this but it works
print(variable, flush=True)
        

Manual way to start gunicorn (as opposed to systemd socket)

gunicorn --bind 127.0.0.1:5000 -w 1 wsgi:app --access-logfile gunicorn-access.log --error-logfile gunicorn-error.log --daemon
# Must be called where app/wsgi file is located
        

Stop all gunicorn daemons

pkill gunicorn
        

See all gunicorn process running

ps ax | grep gunicorn
        

Restart gunicorn manually

# kills ALL gunicorn processes; be wary
pkill gunicorn
gunicorn --bind 127.0.0.1:5000 -w 1 wsgi:app --access-logfile gunicorn-access.log --error-logfile gunicorn-error.log --daemon
# Must be called where app/wsgi file is located