server.rst
This file
Path
docs/server.rst
50 lines · 1.6 KiB
Last changed by
Merge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae
History of this fileTake it
Updated docs for click supportArmin Ronacherbefore adoptione9d1fc4
lines 1–8why, one step back1.. _server:23Development Server4==================56.. currentmodule:: flask78Starting with Flask 1.0 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 utilityUpdated docs for click supportArmin Ronacherbefore adoptione9d1fc4
lines 10–14why, one step back10but you can also continue using the :meth:`Flask.run` method.1112Command Line13------------14Merge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae
line 15why, one step back15The :command:`flask` command line script (:ref:`cli`) is strongly recommende forUpdated docs for click supportArmin Ronacherbefore adoptione9d1fc4
lines 16–20why, one step back16development because it provides a superior reload experience due to how it17loads the application. The basic usage is like this::1819 $ flask -a my_application --debug run20Merge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae
line 21why, one step back21This will enable the debugger, the reloader and then start the server onUpdated docs for click supportArmin Ronacherbefore adoptione9d1fc4
lines 22–34why, one step back22*http://localhost:5000/*.2324The individual features of the server can be controlled by passing more25arguments to the ``run`` option. For instance the reloader can be26disabled::2728 $ flask -a my_application --debug run --no-reload2930In Code31-------3233The alternative way to start the application is through the34:meth:`Flask.run` method. This will immediately launch a local serverMerge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae
line 35why, one step back35exactly the same way the :command:`flask` script does.Updated docs for click supportArmin Ronacherbefore adoptione9d1fc4
lines 36–42why, one step back3637Example::3839 if __name__ == '__main__':40 app.run()4142This works well for the common case but it does not work well forMerge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae
line 43why, one step back43development which is why from Flask 1.0 onwards the :command:`flask` method isUpdated docs for click supportArmin Ronacherbefore adoptione9d1fc4
lines 44–45why, one step back44recommended. The reason for this is that due to how the reload mechanism45works there are some bizarre side-effects (like executing certain codeMerge pull request #1172 from cgar/spellingMarkus Unterwaditzerbefore adoption773ad9b
line 46why, one step back46twice, sometimes crashing without message or dying when a syntax orUpdated docs for click supportArmin Ronacherbefore adoptione9d1fc4
lines 47–50why, one step back47import error happens).4849It is however still a perfectly valid method for invoking a non automatic50reloading application.