server.rst
This file
Path
docs/server.rst
52 lines · 1.6 KiB
Last changed by
resolve merge conflictsKenneth Reitzbefore adoption31174fe
History of this fileTake it
The walk stopped after 200 commits: lines older than 5edc803 point at it.
Added a changelog entry for modules.Armin Ronacherbefore adoption5edc803
lines 1–7why, one step back1.. _server:23Development Server4==================56.. currentmodule:: flask7resolve merge conflictsKenneth Reitzbefore adoption31174fe
line 8why, one step back8Starting with Flask 0.11 there are multiple built-in ways to run aMerge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae
line 9why, one step back9development server. The best one is the :command:`flask` command line utilityAdded a changelog entry for modules.Armin Ronacherbefore adoption5edc803
lines 10–14why, one step back10but 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 forAdded a changelog entry for modules.Armin Ronacherbefore adoption5edc803
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::18resolve merge conflictsKenneth Reitzbefore adoption31174fe
lines 19–21why, one step back19 $ export FLASK_APP=my_application20 $ export FLASK_DEBUG=121 $ flask runAdded a changelog entry for modules.Armin Ronacherbefore adoption5edc803
line 22why, one step back22Merge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae
line 23why, one step back23This will enable the debugger, the reloader and then start the server onAdded a changelog entry for modules.Armin Ronacherbefore adoption5edc803
lines 24–29why, one step back24*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::29resolve merge conflictsKenneth Reitzbefore adoption31174fe
line 30why, one step back30 $ flask run --no-reloadAdded a changelog entry for modules.Armin Ronacherbefore adoption5edc803
lines 31–36why, one step back3132In Code33-------3435The alternative way to start the application is through the36:meth:`Flask.run` method. This will immediately launch a local serverMerge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae
line 37why, one step back37exactly the same way the :command:`flask` script does.Added a changelog entry for modules.Armin Ronacherbefore adoption5edc803
lines 38–44why, one step back3839Example::4041 if __name__ == '__main__':42 app.run()4344This works well for the common case but it does not work well forresolve merge conflictsKenneth Reitzbefore adoption31174fe
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).Added a changelog entry for modules.Armin Ronacherbefore adoption5edc803
lines 50–52why, one step back5051It is however still a perfectly valid method for invoking a non automatic52reloading application.