Run Python Flask Server Application in Background
Jan 7, 2017
Install gunicorn on ubuntu with below command:
sudo apt-get install gunicorn
With gunicorn, you can create multiple processes to handle client requests.
gunicorn -w 15 -b 0.0.0.0:3000 server:app — daemon
Options Explained:
- w: number of worker processes
- b: IP address and port number to bind on which requests will be handled.
- server:app , If server.py is file name and flask is initialized as ‘app’ in it, then we need to pass it like serverfilename:appname.
- daemon: to run in background