2018-11-09 13:41:49 +00:00
|
|
|
## 0.8.3
|
|
|
|
|
|
|
|
* Add 'name' argument to `@app.route()`.
|
|
|
|
* Use 'Host' header for URL reconstruction.
|
|
|
|
|
2018-11-08 17:00:24 +00:00
|
|
|
## 0.8.2
|
|
|
|
|
|
|
|
## StaticFiles
|
|
|
|
|
|
|
|
* StaticFiles no longer reads the file for responses to `HEAD` requests.
|
|
|
|
|
2018-11-08 16:14:14 +00:00
|
|
|
## 0.8.1
|
|
|
|
|
|
|
|
## Templating
|
|
|
|
|
|
|
|
* Add a default templating configuration with Jinja2.
|
|
|
|
|
|
|
|
Allows the following:
|
|
|
|
|
|
|
|
```python
|
|
|
|
app = Starlette(template_directory="templates")
|
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
async def homepage(request):
|
|
|
|
# `url_for` is available inside the template.
|
|
|
|
template = app.get_template('index.html')
|
|
|
|
content = template.render(request=request)
|
|
|
|
return HTMLResponse(content)
|
|
|
|
```
|
|
|
|
|
2018-11-08 12:07:17 +00:00
|
|
|
## 0.8.0
|
|
|
|
|
|
|
|
### Exceptions
|
|
|
|
|
|
|
|
* Add support for `@app.exception_handler(404)`.
|
|
|
|
* Ensure handled exceptions are not seen as errors by the middleware stack.
|
|
|
|
|
|
|
|
### SessionMiddleware
|
|
|
|
|
|
|
|
* Add `max_age`, and use timestamp-signed cookies. Defaults to two weeks.
|
|
|
|
|
|
|
|
### Cookies
|
|
|
|
|
|
|
|
* Ensure cookies are strictly HTTP correct.
|
|
|
|
|
|
|
|
### StaticFiles
|
|
|
|
|
|
|
|
* Check directory exists on instantiation.
|
|
|
|
|
|
|
|
## 0.7.4
|
|
|
|
|
|
|
|
### Concurrency
|
|
|
|
|
|
|
|
* Add `starlette.concurrency.run_in_threadpool`. Now handles `contextvar` support.
|
|
|
|
|
2018-11-06 16:59:54 +00:00
|
|
|
## 0.7.3
|
|
|
|
|
|
|
|
### Routing
|
|
|
|
|
|
|
|
* Add `name=` support to `app.mount()`. This allows eg: `app.mount('/static', StaticFiles(directory='static'), name='static')`.
|
|
|
|
|
2018-11-06 12:21:54 +00:00
|
|
|
## 0.7.2
|
|
|
|
|
|
|
|
### Middleware
|
|
|
|
|
|
|
|
* Add support for `@app.middleware("http")` decorator.
|
|
|
|
|
|
|
|
### Routing
|
|
|
|
|
|
|
|
* Add "endpoint" to ASGI scope.
|
|
|
|
|
2018-11-05 12:08:34 +00:00
|
|
|
## 0.7.1
|
|
|
|
|
|
|
|
### Debug tracebacks
|
|
|
|
|
|
|
|
* Improve debug traceback information & styling.
|
|
|
|
|
|
|
|
### URL routing
|
|
|
|
|
|
|
|
* Support mounted URL lookups with "path=", eg. `url_for('static', path=...)`.
|
|
|
|
* Support nested URL lookups, eg. `url_for('admin:user', username=...)`.
|
|
|
|
* Add redirect slashes support.
|
|
|
|
* Add www redirect support.
|
|
|
|
|
|
|
|
### Background tasks
|
|
|
|
|
|
|
|
* Add background task support to `FileResponse` and `StreamingResponse`.
|
|
|
|
|
2018-11-01 12:56:21 +00:00
|
|
|
## 0.7.0
|
|
|
|
|
|
|
|
### API Schema support
|
|
|
|
|
|
|
|
* Add `app.schema_generator = SchemaGenerator(...)`.
|
|
|
|
* Add `app.schema` property.
|
|
|
|
* Add `OpenAPIResponse(...)`.
|
|
|
|
|
|
|
|
### GraphQL routing
|
|
|
|
|
|
|
|
* Drop `app.add_graphql_route("/", ...)` in favor of more consistent `app.add_route("/", GraphQLApp(...))`.
|
|
|
|
|
2018-10-30 16:11:19 +00:00
|
|
|
## 0.6.3
|
|
|
|
|
2018-11-01 12:56:21 +00:00
|
|
|
### Routing API
|
|
|
|
|
2018-10-30 16:11:19 +00:00
|
|
|
* Support routing to methods.
|
2018-11-01 12:56:21 +00:00
|
|
|
* Ensure `url_path_for` works with Mount('/{some_path_params}').
|
2018-10-30 16:11:19 +00:00
|
|
|
* Fix Router(default=) argument.
|
2018-11-01 12:56:21 +00:00
|
|
|
* Support repeated paths, like: `@app.route("/", methods=["GET"])`, `@app.route("/", methods=["POST"])`
|
2018-10-30 16:11:19 +00:00
|
|
|
* Use the default ThreadPoolExecutor for all sync endpoints.
|
|
|
|
|
2018-10-29 16:43:40 +00:00
|
|
|
## 0.6.2
|
|
|
|
|
|
|
|
### SessionMiddleware
|
|
|
|
|
|
|
|
Added support for `request.session`, with `SessionMiddleware`.
|
|
|
|
|
2018-10-29 13:02:43 +00:00
|
|
|
## 0.6.1
|
|
|
|
|
2018-10-29 13:24:37 +00:00
|
|
|
### BaseHTTPMiddleware
|
|
|
|
|
2018-10-29 13:02:43 +00:00
|
|
|
Added support for `BaseHTTPMiddleware`, which provides a standard
|
|
|
|
request/response interface over a regular ASGI middleware.
|
|
|
|
|
|
|
|
This means you can write ASGI middleware while still working at
|
|
|
|
a request/response level, rather than handling ASGI messages directly.
|
|
|
|
|
|
|
|
```python
|
2018-10-29 13:24:37 +00:00
|
|
|
from starlette.applications import Starlette
|
2018-10-29 13:02:43 +00:00
|
|
|
from starlette.middleware.base import BaseHTTPMiddleware
|
|
|
|
|
|
|
|
|
|
|
|
class CustomMiddleware(BaseHTTPMiddleware):
|
|
|
|
async def dispatch(self, request, call_next):
|
|
|
|
response = await call_next(request)
|
|
|
|
response.headers['Custom-Header'] = 'Example'
|
|
|
|
return response
|
2018-10-29 13:24:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
app = Starlette()
|
|
|
|
app.add_middleware(CustomMiddleware)
|
2018-10-29 13:02:43 +00:00
|
|
|
```
|
|
|
|
|
2018-10-29 09:33:33 +00:00
|
|
|
## 0.6.0
|
|
|
|
|
|
|
|
### request.path_params
|
|
|
|
|
2018-10-29 13:02:43 +00:00
|
|
|
The biggest change in 0.6 is that endpoint signatures are no longer:
|
2018-10-29 09:33:33 +00:00
|
|
|
|
|
|
|
```python
|
|
|
|
async def func(request: Request, **kwargs) -> Response
|
|
|
|
```
|
|
|
|
|
|
|
|
Instead we just use:
|
|
|
|
|
|
|
|
```python
|
|
|
|
async def func(request: Request) -> Response
|
|
|
|
```
|
|
|
|
|
|
|
|
The path parameters are available on the request as `request.path_params`.
|
|
|
|
|
|
|
|
This is different to most Python webframeworks, but I think it actually ends up
|
|
|
|
being much more nicely consistent all the way through.
|
|
|
|
|
2018-10-29 13:02:43 +00:00
|
|
|
### request.url_for()
|
2018-10-29 09:33:33 +00:00
|
|
|
|
2018-10-29 11:14:42 +00:00
|
|
|
Request and WebSocketSession now support URL reversing with `request.url_for(name, **path_params)`.
|
|
|
|
This method returns a fully qualified `URL` instance.
|
|
|
|
The URL instance is a string-like object.
|
|
|
|
|
2018-10-29 13:02:43 +00:00
|
|
|
### app.url_path_for()
|
2018-10-29 11:14:42 +00:00
|
|
|
|
|
|
|
Applications now support URL path reversing with `app.url_path_for(name, **path_params)`.
|
|
|
|
This method returns a `URL` instance with the path and scheme set.
|
|
|
|
The URL instance is a string-like object, and will return only the path if coerced to a string.
|
2018-10-29 09:33:33 +00:00
|
|
|
|
|
|
|
### app.routes
|
|
|
|
|
|
|
|
Applications now support a `.routes` parameter, which returns a list of `[Route|WebSocketRoute|Mount]`.
|
|
|
|
|
|
|
|
### Route, WebSocketRoute, Mount
|
|
|
|
|
|
|
|
The low level components to `Router` now match the `@app.route()`, `@app.websocket_route()`, and `app.mount()` signatures.
|