mirror of https://github.com/encode/starlette.git
Docs and version bump
This commit is contained in:
parent
78ff55dde3
commit
9b57e516cc
|
@ -83,7 +83,7 @@ Starlette does not have any hard dependencies, but the following are optional:
|
|||
|
||||
* [`requests`][requests] - Required if you want to use the `TestClient`.
|
||||
* [`aiofiles`][aiofiles] - Required if you want to use `FileResponse` or `StaticFiles`.
|
||||
* [`jinja2`][jinja2] - Required if you want to use the default template configuration.
|
||||
* [`jinja2`][jinja2] - Required if you want to use `Jinja2Templates`.
|
||||
* [`python-multipart`][python-multipart] - Required if you want to support form parsing, with `request.form()`.
|
||||
* [`itsdangerous`][itsdangerous] - Required for `SessionMiddleware` support.
|
||||
* [`sqlalchemy`][sqlalchemy] - Required for `DatabaseMiddleware` support.
|
||||
|
|
|
@ -79,7 +79,7 @@ Starlette does not have any hard dependencies, but the following are optional:
|
|||
|
||||
* [`requests`][requests] - Required if you want to use the `TestClient`.
|
||||
* [`aiofiles`][aiofiles] - Required if you want to use `FileResponse` or `StaticFiles`.
|
||||
* [`jinja2`][jinja2] - Required if you want to use the default template configuration.
|
||||
* [`jinja2`][jinja2] - Required if you want to use `Jinja2Templates`.
|
||||
* [`python-multipart`][python-multipart] - Required if you want to support form parsing, with `request.form()`.
|
||||
* [`itsdangerous`][itsdangerous] - Required for `SessionMiddleware` support.
|
||||
* [`sqlalchemy`][sqlalchemy] - Required for `DatabaseMiddleware` support.
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
## 0.10.3
|
||||
|
||||
* Templates are now configured independently from the application instance. `templates = Jinja2Templates(directory=...)`. Existing API remains in place, but is no longer documented,
|
||||
and will be deprecated in due course. See the template documentation for more details.
|
||||
|
||||
## 0.10.2
|
||||
|
||||
* Don't drop explicit port numbers on redirects from `HTTPSRedirectMiddleware`.
|
||||
|
||||
## 0.10.1
|
||||
|
||||
* Add MySQL database support.
|
||||
|
|
|
@ -20,11 +20,13 @@ async def homepage(request):
|
|||
return templates.TemplateResponse('index.html', {'request': request})
|
||||
```
|
||||
|
||||
The Jinja2 environment sets up a global `url_for` included, which allows us to
|
||||
use `url_for` inside our templates. We always need to pass the incoming `request`
|
||||
instance as part of the template context.
|
||||
Note that the incoming `request` instance must be included as part of the
|
||||
template context.
|
||||
|
||||
We can now link to static files from within our HTML templates. For example:
|
||||
The Jinja2 template context will automatically include a `url_for` function,
|
||||
so we can correctly hyperlink to other pages within the application.
|
||||
|
||||
For example, we can link to static files from within our HTML templates:
|
||||
|
||||
```html
|
||||
<link href="{{ url_for('static', path='/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
|
@ -50,6 +52,6 @@ Jinja2 supports async template rendering, however as a general rule
|
|||
we'd recommend that you keep your templates free from logic that invokes
|
||||
database lookups, or other I/O operations.
|
||||
|
||||
Instead we'd recommend that you ensure that your views perform all I/O,
|
||||
Instead we'd recommend that you ensure that your endpoints perform all I/O,
|
||||
for example, strictly evaluate any database queries within the view and
|
||||
include the final results in the context.
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "0.10.2"
|
||||
__version__ = "0.10.3"
|
||||
|
|
Loading…
Reference in New Issue