Skip to content
Myr

Move docs explaining instantiating Flask

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alex Couper · committed by Alex Couper · parent a92588f · Browse files · 1 file+8 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−9 removed

  • other:+8 added−9 removed

1 file+8 added−9 removed

modified:docs/quickstart.rst+8 added-9 removed
36 unmodified lines
3738So what did that code do?39401. First we imported the :class:`~flask.Flask` class. An instance of this41 class will be our WSGI application. The first argument is the name of42 the application's module. If you are using a single module (as in this43 example), you should use `__name__` because depending on if it's started as44 application or imported as module the name will be different (``'__main__'``45 versus the actual import name). For more information, have a look at the46 :class:`~flask.Flask` documentation.472. Next we create an instance of this class. We pass it the name of the module48 or package. This is needed so that Flask knows where to look for templates,49 static files, and so on.41 class will be our WSGI application. 422. Next we create an instance of this class. The first argument is the name of43 the application's module or package. If you are using a single module (as44 in this example), you should use `__name__` because depending on if it's45 started as application or imported as module the name will be different46 (``'__main__'`` versus the actual import name). For more information, have47 a look at the :class:`~flask.Flask` documentation. This is needed so that48 Flask knows where to look for templates, static files, and so on.493. We then use the :meth:`~flask.Flask.route` decorator to tell Flask what URL50 should trigger our function.514. The function is given a name which is also used to generate URLs for that52 particular function, and returns the message we want to display in the
800 unmodified lines