apache - Auto reloading python Flask app upon code changes -
i'm investigating how develop decent web app python. since don't want high-order structures in way, choice fell on lightweight flask framework. time tell if right choice.
so, i've set apache server mod_wsgi, , test site running fine. however, i'd speed development routine making site automatically reload upon changes in py or template files make. see changes in site's .wsgi file causes reloading (even without wsgiscriptreloading on in apache config file), still have prod manually (ie, insert linebreak, save). there way how cause reload when edit of app's py files? or, expected use ide refreshes .wsgi file me?
the current recommended way (flask >= 0.11) flask
command line utility.
http://flask.pocoo.org/docs/0.11/server/
example:
$ export flask_app=main.py $ export flask_debug=1 $ python -m flask run
or in 1 command:
$ flask_app=main.py flask_debug=1 python -m flask run
i prefer python -m flask run
rather flask run
because former works virtualenv
.
if want different port default (5000
) add --port
option.
example:
$ python -m flask run --port 8080
more options available with:
$ python -m flask run --help
Comments
Post a Comment