Skip to content
Myr

Merge pull request #4654 from hankhank10/main

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

authored by David Lord · committed by GitHub · parents f6be300, 64ab598 · Browse files · 1 file+18 added−0 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+18 added−0 removed

  • other:+18 added−0 removed

1 file+18 added−0 removed

modified:docs/quickstart.rst+18 added
388 unmodified lines
389 return do_the_login()390 else:391 return show_the_login_form()392393The example above keeps all methods for the route within one function,394which can be useful if each part uses some common data.395396You can also separate views for different methods into different397functions. Flask provides a shortcut for decorating such routes with398:meth:`~flask.Flask.get`, :meth:`~flask.Flask.post`, etc. for each399common HTTP method.400401.. code-block:: python402403 @app.get('/login')404 def login_get():405 return show_the_login_form()406407 @app.post('/login')408 def login_post():409 return do_the_login()410411If ``GET`` is present, Flask automatically adds support for the ``HEAD`` method412and handles ``HEAD`` requests according to the `HTTP RFC`_. Likewise,413``OPTIONS`` is automatically implemented for you.414
562 unmodified lines