Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you daemonize a Flask application?

Tags:

python

flask

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?

like image 272
James Avatar asked Jun 13 '11 22:06

James


People also ask

How do I make a Flask app installable?

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.


1 Answers

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).

like image 142
zeekay Avatar answered Sep 22 '22 08:09

zeekay