diff --git a/README.md b/README.md index 095124e2..29036f48 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/docs/index.md b/docs/index.md index d6f814f5..3133bbde 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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. diff --git a/docs/release-notes.md b/docs/release-notes.md index 4fd7d9a6..ac69809a 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -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. diff --git a/docs/templates.md b/docs/templates.md index faabdec6..bcc8e56a 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -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 @@ -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. diff --git a/starlette/__init__.py b/starlette/__init__.py index 17c1a626..b2385cb4 100644 --- a/starlette/__init__.py +++ b/starlette/__init__.py @@ -1 +1 @@ -__version__ = "0.10.2" +__version__ = "0.10.3"