server.rst
This file
Path
docs/server.rst
52 lines · 1.6 KiB
Last changed by
1.0 -> 0.11 in the docsArmin Ronacherbefore adoptionf9ea3fe
History of this fileTake it
The walk stopped after 200 commits: lines older than 41b5d77 point at it.
Merge pull request #1273 from prakashpp/patch-1Markus Unterwaditzerbefore adoption41b5d77
lines 1–7why, one step back1.. _server:23Development Server4==================56.. currentmodule:: flask71.0 -> 0.11 in the docsArmin Ronacherbefore adoptionf9ea3fe
line 8why, one step back8Starting with Flask 0.11 there are multiple built-in ways to run aMerge pull request #1273 from prakashpp/patch-1Markus Unterwaditzerbefore adoption41b5d77
lines 9–14why, one step back9development server. The best one is the :command:`flask` command line utility10but you can also continue using the :meth:`Flask.run` method.1112Command Line13------------14Merge pull request #1418 from alexwlchan/masterKeyan Pishdadianbefore adoptiondac45f6
line 15why, one step back15The :command:`flask` command line script (:ref:`cli`) is strongly recommended forMerge pull request #1273 from prakashpp/patch-1Markus Unterwaditzerbefore adoption41b5d77
lines 16–18why, one step back16development because it provides a superior reload experience due to how it17loads the application. The basic usage is like this::18More doc updates for FLASK_APPArmin Ronacherbefore adoption1df426a
lines 19–21why, one step back19 $ export FLASK_APP=my_application20 $ export FLASK_DEBUG=121 $ flask runMerge pull request #1273 from prakashpp/patch-1Markus Unterwaditzerbefore adoption41b5d77
lines 22–29why, one step back2223This will enable the debugger, the reloader and then start the server on24*http://localhost:5000/*.2526The individual features of the server can be controlled by passing more27arguments to the ``run`` option. For instance the reloader can be28disabled::29More doc updates for FLASK_APPArmin Ronacherbefore adoption1df426a
line 30why, one step back30 $ flask run --no-reloadMerge pull request #1273 from prakashpp/patch-1Markus Unterwaditzerbefore adoption41b5d77
lines 31–44why, one step back3132In Code33-------3435The alternative way to start the application is through the36:meth:`Flask.run` method. This will immediately launch a local server37exactly the same way the :command:`flask` script does.3839Example::4041 if __name__ == '__main__':42 app.run()4344This works well for the common case but it does not work well forMore doc updates for FLASK_APPArmin Ronacherbefore adoption1df426a
lines 45–49why, one step back45development which is why from Flask 0.11 onwards the :command:`flask`46method is recommended. The reason for this is that due to how the reload47mechanism works there are some bizarre side-effects (like executing48certain code twice, sometimes crashing without message or dying when a49syntax or import error happens).Merge pull request #1273 from prakashpp/patch-1Markus Unterwaditzerbefore adoption41b5d77
lines 50–52why, one step back5051It is however still a perfectly valid method for invoking a non automatic52reloading application.