Commit graph

1489 commits

Author SHA1 Message Date
Hugo Montenegro
89652cece5 Update celery.rst
small typo
2021-06-08 19:01:07 +02:00
Miguel Grinberg
ca2788ead6 Support View and MethodView instances with async handlers 2021-06-01 18:08:19 +00:00
laggardkernel
bddc916b1d Update doc about minimal Python version for async support 2021-05-30 11:03:49 +00:00
Grey Li
6cdc3eef15 Fix typo in docs/tutorial/index.rst 2021-05-24 16:33:02 +08:00
Grey Li
13ee3c63cf Fix view decorators docs 2021-05-21 12:11:03 +00:00
David Lord
5ff1f02e94 update pallets-sphinx-themes 2021-05-20 21:03:02 -07:00
Rafael Aviles
da7ddcaf80 Use escape function in return statement for username and subpath. 2021-05-14 13:23:34 -07:00
Andrew J Roth
5279299277 Added Google Cloud Run as a Hosted option 2021-05-12 09:14:34 -04:00
Grey Li
6b6da7550b Fix typo in the example of nesting bp docs 2021-05-12 07:49:34 +00:00
David Lord
0fa6b55517 rename default branch in files 2021-05-11 15:18:41 -07:00
Grey Li
c0c0518b50 Improve the wording of using FLASK_APP 2021-05-10 22:58:19 -07:00
David Lord
c4cdac59f5 show type hints in description 2021-05-10 22:45:42 -07:00
pgjones
271eede7ad Simplify the async handling code
Firstly `run_sync` was a misleading name as it didn't run anything,
instead I think `async_to_sync` is much clearer as it converts a
coroutine function to a function. (Name stolen from asgiref).

Secondly trying to run the ensure_sync during registration made the
code more complex and brittle, e.g. the _flask_async_wrapper
usage. This was done to pay any setup costs during registration rather
than runtime, however this only saved a iscoroutne check. It allows
the weirdness of the Blueprint and Scaffold ensure_sync methods to be
removed.

Switching to runtime ensure_sync usage provides a method for
extensions to also support async, as now documented.
2021-05-03 06:15:39 -07:00
Joshua Bronson
78722f5f7b Minor docs fixes. (#3988) 2021-05-02 16:05:08 -04:00
Grey Li
62233720d4 Add tips for using async on Windows on Python 3.8 2021-04-29 10:59:26 +08:00
David Lord
3b143eb64a Merge pull request #3967 from pgjones/docs 2021-04-17 07:34:56 -07:00
pgjones
65cffeba07 Update documentation on asyncio background tasks
This has been an early question from users, so best to explain.
2021-04-17 15:13:33 +01:00
pgjones
bc1fea4e3a Update the docs on serving with ASGI
Whilst it has been possible to serve via an ASGI server for a while
(using WSGI to ASGI middleware/adapters) it hasn't added much. Now
though it makes sense to recommend the asgiref adapter as it
integrates with the same event loop used for async route handlers
etc...
2021-04-17 11:30:22 +01:00
David Lord
a37c949ff8 Merge remote-tracking branch 'origin/1.1.x' into release-2.0.0rc1 2021-04-16 08:37:56 -07:00
pgjones
257c7c5c2a Nested blueprints
This allows blueprints to be nested within blueprints via a new
Blueprint.register_blueprint method. This should provide a use case
that has been desired for the past ~10 years.

This works by setting the endpoint name to be the blueprint names,
from parent to child delimeted by "." and then iterating over the
blueprint names in reverse order in the app (from most specific to
most general). This means that the expectation of nesting a blueprint
within a nested blueprint is met.
2021-04-14 09:25:42 -07:00
David Lord
3053c7a39d update async docs 2021-04-06 15:33:06 -07:00
pgjones
c9f774d650 Add async support
This allows for async functions to be passed to the Flask class
instance, for example as a view function,

    @app.route("/")
    async def index():
        return "Async hello"

this comes with a cost though of poorer performance than using the
sync equivalent.

asgiref is the standard way to run async code within a sync context,
and is used in Django making it a safe and sane choice for this.
2021-04-06 09:35:10 -07:00
kangetsu121
ae9bd3bd34 fix a broken link 2021-03-16 16:30:54 +00:00
David Lord
041c463b97 Merge pull request #3922 from pallets/consistency
various cleanup for consistency between projects
2021-02-24 10:35:16 -08:00
David Lord
9dbfdeb035 docs rename changelog to changes 2021-02-24 10:09:38 -08:00
David Lord
bf473c8e3b update project links 2021-02-24 10:09:15 -08:00
Grey Li
9224860896 Remove the mention of Flask-OAuth in the extension dev docs 2021-02-19 22:59:09 +08:00
David Lord
39d978f42b use Jinja's tojson filter 2021-02-01 22:48:09 -08:00
Tony De La Nuez
7c9f74e6cc got_request_exception only sends unhandled exceptions
Co-authored-by: David Lord <davidism@gmail.com>
2021-02-01 20:28:10 -08:00
David Lord
6d3a0c9a36 simplify InternalServerError.original_exception 2021-01-29 11:26:17 -08:00
David Lord
8853be019a remove BaseRequest and BaseResponse 2021-01-29 10:52:48 -08:00
David Lord
6e1e0c8a37 remove JSONMixin 2021-01-29 10:52:48 -08:00
Elliott King
56ed1574ee Clarify json error handling 2021-01-27 12:08:02 -05:00
Grey Li
2b0a29b708 Merge remote-tracking branch 'origin/1.1.x' 2020-12-30 21:00:49 +08:00
jordivandooren
1426d8e30d fix explanation of wheel name (#3848)
* fix explanation of wheel name

* Improve the description of wheel filename format

Co-authored-by: Grey Li <withlihui@gmail.com>
2020-12-30 18:57:37 +08:00
David Lord
26bb6b1c56 move send_file and send_from_directory to Werkzeug
The implementations were moved to Werkzeug, Flask's functions become
wrappers around Werkzeug to pass some Flask-specific values.

cache_timeout is renamed to max_age. SEND_FILE_MAX_AGE_DEFAULT,
app.send_file_max_age_default, and app.get_send_file_max_age defaults
to None. This tells the browser to use conditional requests rather than
a 12 hour cache.

attachment_filename is renamed to download_name, and is always sent if
a name is known.

Deprecate helpers.safe_join in favor of werkzeug.utils.safe_join.

Removed most of the send_file tests, they're tested in Werkzeug.

In the file upload example, renamed the uploaded_file view to
download_file to avoid a common source of confusion.
2020-11-05 09:27:52 -08:00
David Lord
d81e5f8b6c Merge branch '1.1.x' 2020-11-04 18:25:37 -08:00
Sarthak Vineet Kumar
024417694e updated doc for mod_wsgi (#3751)
Co-authored-by: Sarthak <sarthak@MacBook.local>
2020-11-04 18:20:36 -08:00
Viet Hung Nguyen
d37a8a0851 mkstemp returns a file descriptor (#3809) 2020-10-31 20:09:57 -07:00
Bart Broere
28467dbcef removing outdated xhtml information (#3802) 2020-10-21 14:13:41 -07:00
Grey Li
6219702269 Add command switch tabs for Bash, CMD and Powershell with sphinx-tabs (#3714)
* Enable Sphinx extension sphinx-tabs

* Add command tabs for all export commands

* Add command tabs for all venv commands

Fix trim spaces
2020-10-15 14:08:37 -07:00
Jamiu Salimon
096ace23ba Update the signature of the teardown function (#3730)
Co-authored-by: David Lord <davidism@gmail.com>
2020-10-15 14:02:54 -07:00
Henry Kobin
426d0e4e9a updated Sentry link (#3788) 2020-10-11 19:15:19 -07:00
sblondon
b5859ea9eb aesthetic: add a space after a comma (#3771) 2020-09-28 07:21:13 -07:00
miquelvir
cd5be90d5b fix grammar (#3769) 2020-09-28 06:21:59 -07:00
Ebram Shehata
0d0d3bbd1d Update quickstart.rst (#3767) 2020-09-25 16:52:00 -07:00
girst
511649e747 Correct Sentry advertisement (not Free Software) (#3758) 2020-09-15 09:20:10 -07:00
Grey Li
f4861793fd Fix bad intersphinx link 2020-08-07 19:01:42 +08:00
David Lord
9a960a4ff0 Merge pull request #3669 from ebonnecab/error-docs
Error Docs Revision/Consolidation
2020-07-28 14:17:36 -07:00
David Lord
6a152a111c rewrite debugging docs, move to separate page 2020-07-28 11:20:34 -07:00