This must be married with a uwsgi service started by a script in /etc/init.d/ :
And this has configuration information in /etc/sysconfig/uwsgi . The following works for (i) a core flask file at /home/example/flask/example.py, and (ii) for a flask module (rather than a single file executable), /etc/sysconfig/uwsgi (for a flask module starting at /home/example/flask/example/init.py) :
Note that (under /home/example/env) there’s a python virtualenv created with :
Also note that there needs to be a python stub to actually declare the flask ‘app’ :
CASE1 : there’s a python file ‘example.py’ in /home/example/flask/example.py that defines the flask application ‘app’. This file can also define a main, so that it can be used as a dev-machine launcher too. The standard flask minimal intro file will work fine : The body of the file defines ‘app’ which will be picked up by uwsgi (for production), or run via the “ if name == ‘main’: “ pattern for development.
CASE2 : there’s a python file ‘init.py’ in /home/example/flask/example/ that defines the flask application ‘app’. To make this setup function as a dev machine, you’ll also need to create something that runs this setup locally. The simplest seems to be to create ‘run.py’ (in the same directory from which the example module branches off) :