Skip to content
Myr

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 file

Take it

Updated docs for click supportArmin Ronacherbefore adoptione9d1fc4

lines 1–8why, one step back
1.. _server:
23Development Server4==================56.. currentmodule:: flask78Starting with Flask 1.0 there are multiple built-in ways to run a

Merge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae

line 9why, one step back
9development server. The best one is the :command:`flask` command line utility

Updated docs for click supportArmin Ronacherbefore adoptione9d1fc4

lines 10–14why, one step back
10but you can also continue using the :meth:`Flask.run` method.
1112Command Line13------------14

Merge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae

line 15why, one step back
15The :command:`flask` command line script (:ref:`cli`) is strongly recommende for

Updated docs for click supportArmin Ronacherbefore adoptione9d1fc4

lines 16–20why, one step back
16development because it provides a superior reload experience due to how it
17loads the application. The basic usage is like this::1819 $ flask -a my_application --debug run20

Merge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae

line 21why, one step back
21This will enable the debugger, the reloader and then start the server on

Updated docs for click supportArmin Ronacherbefore adoptione9d1fc4

lines 22–34why, one step back
22*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 server

Merge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae

line 35why, one step back
35exactly the same way the :command:`flask` script does.

Updated docs for click supportArmin Ronacherbefore adoptione9d1fc4

lines 36–42why, one step back
36
37Example::3839 if __name__ == '__main__':40 app.run()4142This works well for the common case but it does not work well for

Merge pull request #1240 from defuz/docs-style-fix-2Markus Unterwaditzerbefore adoption6fcc2ae

line 43why, one step back
43development which is why from Flask 1.0 onwards the :command:`flask` method is

Updated docs for click supportArmin Ronacherbefore adoptione9d1fc4

lines 44–45why, one step back
44recommended. The reason for this is that due to how the reload mechanism
45works there are some bizarre side-effects (like executing certain code

Merge pull request #1172 from cgar/spellingMarkus Unterwaditzerbefore adoption773ad9b

line 46why, one step back
46twice, sometimes crashing without message or dying when a syntax or

Updated docs for click supportArmin Ronacherbefore adoptione9d1fc4

lines 47–50why, one step back
47import error happens).
4849It is however still a perfectly valid method for invoking a non automatic50reloading application.