Merge branch '1.1.x'

This commit is contained in:
David Lord 2019-09-23 08:38:29 -07:00
commit 40eadfc52a
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
10 changed files with 72 additions and 72 deletions

View file

@ -62,12 +62,12 @@ dispatched based on prefix.
For example you could have your main application run on ``/`` and your
backend interface on ``/backend``::
from werkzeug.wsgi import DispatcherMiddleware
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from frontend_app import application as frontend
from backend_app import application as backend
application = DispatcherMiddleware(frontend, {
'/backend': backend
'/backend': backend
})

View file

@ -121,7 +121,7 @@ Alternatively you can register `uploaded_file` as `build_only` rule and
use the :class:`~werkzeug.wsgi.SharedDataMiddleware`. This also works with
older versions of Flask::
from werkzeug import SharedDataMiddleware
from werkzeug.middleware.shared_data import SharedDataMiddleware
app.add_url_rule('/uploads/<filename>', 'uploaded_file',
build_only=True)
app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {

View file

@ -3,15 +3,16 @@
Patterns for Flask
==================
Certain things are common enough that the chances are high you will find
them in most web applications. For example quite a lot of applications
are using relational databases and user authentication. In that case,
chances are they will open a database connection at the beginning of the
request and get the information of the currently logged in user. At the
end of the request, the database connection is closed again.
Certain features and interactions are common enough that you will find
them in most web applications. For example, many applications use a
relational database and user authentication. They will open a database
connection at the beginning of the request and get the information for
the logged in user. At the end of the request, the database connection
is closed.
There are more user contributed snippets and patterns in the `Flask
Snippet Archives <http://flask.pocoo.org/snippets/>`_.
These types of patterns may be a bit outside the scope of Flask itself,
but Flask makes it easy to implement them. Some common patterns are
collected in the following pages.
.. toctree::
:maxdepth: 2

View file

@ -58,7 +58,7 @@ loaded upfront. The trick is to actually load the view function as needed.
This can be accomplished with a helper class that behaves just like a
function but internally imports the real function on first use::
from werkzeug import import_string, cached_property
from werkzeug.utils import import_string, cached_property
class LazyView(object):

View file

@ -70,7 +70,7 @@ straightforward to read.
The decorated function will then work as follows
1. get the unique cache key for the current request base on the current
1. get the unique cache key for the current request based on the current
path.
2. get the value for that key from the cache. If the cache returned
something we will return that value.