Skip to content
Myr

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 file

Take it

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

Merge pull request #1262 from msabramo/JSONIFY_END_WITH_NEWLINEMarkus Unterwaditzerbefore adoptioneca5306

lines 1–7why, one step back
1.. _server:
23Development Server4==================56.. currentmodule:: flask7

1.0 -> 0.11 in the docsArmin Ronacherbefore adoptionf9ea3fe

line 8why, one step back
8Starting with Flask 0.11 there are multiple built-in ways to run a

Merge pull request #1262 from msabramo/JSONIFY_END_WITH_NEWLINEMarkus Unterwaditzerbefore adoptioneca5306

lines 9–14why, one step back
9development server. The best one is the :command:`flask` command line utility
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 pull request #1262 from msabramo/JSONIFY_END_WITH_NEWLINEMarkus Unterwaditzerbefore adoptioneca5306

lines 16–18why, one step back
16development because it provides a superior reload experience due to how it
17loads the application. The basic usage is like this::18

More doc updates for FLASK_APPArmin Ronacherbefore adoption1df426a

lines 19–21why, one step back
19 $ export FLASK_APP=my_application
20 $ export FLASK_DEBUG=121 $ flask run

Merge pull request #1262 from msabramo/JSONIFY_END_WITH_NEWLINEMarkus Unterwaditzerbefore adoptioneca5306

lines 22–29why, one step back
22
23This 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::29

More doc updates for FLASK_APPArmin Ronacherbefore adoption1df426a

line 30why, one step back
30 $ flask run --no-reload

Merge pull request #1262 from msabramo/JSONIFY_END_WITH_NEWLINEMarkus Unterwaditzerbefore adoptioneca5306

lines 31–44why, one step back
31
32In 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 for

More doc updates for FLASK_APPArmin Ronacherbefore adoption1df426a

lines 45–49why, one step back
45development 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 #1262 from msabramo/JSONIFY_END_WITH_NEWLINEMarkus Unterwaditzerbefore adoptioneca5306

lines 50–52why, one step back
50
51It is however still a perfectly valid method for invoking a non automatic52reloading application.