I have 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?
Installing a Flask app can be achieved very easily using the setuptools library of Python. We will have to create a file called setup.py in our application's folder and configure it to run a setup script for our application. It will take care of any dependencies, descriptions, loading test packages, and so on.
There are several ways to deploy a Flask project. Deploying with gunicorn might be the easiest, install gunicorn and then:
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With