I hav a small application written in Python using Flask. Right now I'm running it under nohup, but I'd like to daemonize it. What's the proper way of doing this?
gunicorn project:app --daemon
Although you probably want to use supervisor or something of that nature to monitor gunicorn (at the very least use
--pid so you can reload/stop gunicorn easily).
If you have supervisor installed already, I think gunicorn would be a little redundant. The following is a flask.ini file that can be dropped in /etc/supervisord.d/ (then "supervisorctl reload" to reload the config and start the process).
command=/opt/flask/env0/bin/python /opt/flask/developer/FlaskWebServer.py directory=/opt/flask redirect_stderr=true startsecs=5 autorestart=true stdout_logfile=/opt/flask/flask.stdout.log