Skip to content
Myr

server.rst

This file

Path

docs/server.rst

50 lines · 1.6 KiB

Last changed by

Merge pull request #1418 from alexwlchan/masterKeyan Pishdadianbefore adoptiondac45f6

History of this file

Take it

The walk stopped after 200 commits: lines older than 5693b9d point at it.

Merge branch 'pr/839'Armin Ronacherbefore adoption5693b9d

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

Merge branch 'pr/839'Armin Ronacherbefore adoption5693b9d

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

Merge pull request #1418 from alexwlchan/masterKeyan Pishdadianbefore adoptiondac45f6

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

Merge branch 'pr/839'Armin Ronacherbefore adoption5693b9d

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

Merge branch 'pr/839'Armin Ronacherbefore adoption5693b9d

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.

Merge branch 'pr/839'Armin Ronacherbefore adoption5693b9d

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

Merge branch 'pr/839'Armin Ronacherbefore adoption5693b9d

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

Merge branch 'pr/839'Armin Ronacherbefore adoption5693b9d

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