Merge branch '2.2.x'
This commit is contained in:
commit
73b9bacbf7
11 changed files with 25 additions and 15 deletions
|
|
@ -4,6 +4,12 @@ Version 2.3.0
|
|||
Unreleased
|
||||
|
||||
|
||||
Version 2.2.3
|
||||
-------------
|
||||
|
||||
Unreleased
|
||||
|
||||
|
||||
Version 2.2.2
|
||||
-------------
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ interface. The links below are for some of the most common platforms,
|
|||
which have instructions for Flask, WSGI, or Python.
|
||||
|
||||
- `PythonAnywhere <https://help.pythonanywhere.com/pages/Flask/>`_
|
||||
- `Heroku <https://devcenter.heroku.com/articles/getting-started-with-python>`_
|
||||
- `Google App Engine <https://cloud.google.com/appengine/docs/standard/python3/building-app>`_
|
||||
- `Google Cloud Run <https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service>`_
|
||||
- `AWS Elastic Beanstalk <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-flask.html>`_
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ pattern, use ``--call {module}:{factory}`` instead.
|
|||
.. code-block:: text
|
||||
|
||||
# equivalent to 'from hello import app'
|
||||
$ waitress-serve hello:app --host 127.0.0.1
|
||||
$ waitress-serve --host 127.0.0.1 hello:app
|
||||
|
||||
# equivalent to 'from hello import create_app; create_app()'
|
||||
$ waitress-serve --call hello:create_app --host 127.0.0.1
|
||||
$ waitress-serve --host 127.0.0.1 --call hello:create_app
|
||||
|
||||
Serving on http://127.0.0.1:8080
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ context is active when a request context is, or when a CLI command is
|
|||
run. If you're storing something that should be closed, use
|
||||
:meth:`~flask.Flask.teardown_appcontext` to ensure that it gets closed
|
||||
when the application context ends. If it should only be valid during a
|
||||
request, or would not be used in the CLI outside a reqeust, use
|
||||
request, or would not be used in the CLI outside a request, use
|
||||
:meth:`~flask.Flask.teardown_request`.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ It is important to understand the difference between templates and
|
|||
JavaScript. Templates are rendered on the server, before the response is
|
||||
sent to the user's browser. JavaScript runs in the user's browser, after
|
||||
the template is rendered and sent. Therefore, it is impossible to use
|
||||
JavaScript to affect how the Jinja template is rendered, but is is
|
||||
JavaScript to affect how the Jinja template is rendered, but it is
|
||||
possible to render data into the JavaScript that will run.
|
||||
|
||||
To provide data to JavaScript when rendering the template, use the
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ data and to then invoke that function and pass it to a response object::
|
|||
def generate():
|
||||
for row in iter_all_rows():
|
||||
yield f"{','.join(row)}\n"
|
||||
return generate(), {"Content-Type": "text/csv")
|
||||
return generate(), {"Content-Type": "text/csv"}
|
||||
|
||||
Each ``yield`` expression is directly sent to the browser. Note though
|
||||
that some WSGI middlewares might break streaming, so be careful there in
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ itself.
|
|||
|
||||
To run the application, use the ``flask`` command or
|
||||
``python -m flask``. You need to tell the Flask where your application
|
||||
is with the ``-app`` option.
|
||||
is with the ``--app`` option.
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ to it.
|
|||
version='1.0.0',
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
install_requires=[
|
||||
'flask',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -116,7 +116,10 @@ function.
|
|||
item = self.model.query.get_or_404(id)
|
||||
return render_template(self.template, item=item)
|
||||
|
||||
app.add_url_rule("/users/<int:id>", view_func=DetailView.as_view("user_detail"))
|
||||
app.add_url_rule(
|
||||
"/users/<int:id>",
|
||||
view_func=DetailView.as_view("user_detail", User)
|
||||
)
|
||||
|
||||
|
||||
View Lifetime and ``self``
|
||||
|
|
@ -295,8 +298,10 @@ provide get (list) and post (create) methods.
|
|||
return jsonify(item.to_json())
|
||||
|
||||
def register_api(app, model, url):
|
||||
app.add_url_rule(f"/{name}/<int:id>", view_func=ItemAPI(f"{name}-item", model))
|
||||
app.add_url_rule(f"/{name}/", view_func=GroupAPI(f"{name}-group", model))
|
||||
item = ItemAPI.as_view(f"{name}-item", model)
|
||||
group = GroupAPI.as_view(f"{name}-group", model)
|
||||
app.add_url_rule(f"/{name}/<int:id>", view_func=item)
|
||||
app.add_url_rule(f"/{name}/", view_func=group)
|
||||
|
||||
register_api(app, User, "users")
|
||||
register_api(app, Story, "stories")
|
||||
|
|
|
|||
|
|
@ -275,8 +275,9 @@ class Config(dict):
|
|||
def from_mapping(
|
||||
self, mapping: t.Optional[t.Mapping[str, t.Any]] = None, **kwargs: t.Any
|
||||
) -> bool:
|
||||
"""Updates the config like :meth:`update` ignoring items with non-upper
|
||||
keys.
|
||||
"""Updates the config like :meth:`update` ignoring items with
|
||||
non-upper keys.
|
||||
|
||||
:return: Always returns ``True``.
|
||||
|
||||
.. versionadded:: 0.11
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ def __getattr__(name: str) -> t.Any:
|
|||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"'_app_ctx_stack' is deprecated and will be remoevd in Flask 2.3.",
|
||||
"'_app_ctx_stack' is deprecated and will be removed in Flask 2.3.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
|
@ -98,7 +98,7 @@ def __getattr__(name: str) -> t.Any:
|
|||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"'_request_ctx_stack' is deprecated and will be remoevd in Flask 2.3.",
|
||||
"'_request_ctx_stack' is deprecated and will be removed in Flask 2.3.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue