Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions guide/content/en/guide/advanced/class-based-views.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ A class-based view should subclass :class:`sanic.views.HTTPMethodView`. You can

## Path parameters


.. column::

You can use path parameters exactly as discussed in [the routing section](/guide/basics/routing.md).
You can use path parameters exactly as discussed in [the routing section](../basics/routing.md).

.. column::

Expand All @@ -126,7 +127,7 @@ A class-based view should subclass :class:`sanic.views.HTTPMethodView`. You can

## Decorators

As discussed in [the decorators section](/guide/best-practices/decorators.md), often you will need to add functionality to endpoints with the use of decorators. You have two options with CBV:
As discussed in [the decorators section](../best-practices/decorators.md), often you will need to add functionality to endpoints with the use of decorators. You have two options with CBV:

1. Apply to _all_ HTTP methods in the view
2. Apply individually to HTTP methods in the view
Expand Down Expand Up @@ -183,7 +184,7 @@ Let's see what the options look like:

.. column::

This works just like [generating any other URL](/guide/basics/routing.md#generating-a-url), except that the class name is a part of the endpoint.
This works just like [generating any other URL](../basics/routing.md#generating-a-url), except that the class name is a part of the endpoint.

.. column::

Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/advanced/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This feature was added in version 24.12

Sanic ships with a [CLI](../running/running.html#running-via-command) for running the Sanic server. Sometimes, you may have the need to enhance that CLI to run your own custom commands. Commands are invoked using the following basic pattern:
Sanic ships with a [CLI](../running/running.md#running-via-command) for running the Sanic server. Sometimes, you may have the need to enhance that CLI to run your own custom commands. Commands are invoked using the following basic pattern:

```sh
sanic path.to:app exec <command> [--arg=value]
Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/advanced/proxy-headers.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Sanic may be configured to use proxy headers for determining the true client IP,

.. column::

Services behind reverse proxies must configure one or more of the following [configuration values](/guide/deployment/configuration.md):
Services behind reverse proxies must configure one or more of the following [configuration values](../deployment/configuration.md):

- `FORWARDED_SECRET`
- `REAL_IP_HEADER`
Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/advanced/websockets.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Sanic provides an easy to use abstraction on top of [websockets](https://websock

## Configuration

See [configuration section](/guide/deployment/configuration.md) for more details, however the defaults are shown below.
See [configuration section](../running/configuration.md) for more details, however the defaults are shown below.

```python
app.config.WEBSOCKET_MAX_SIZE = 2 ** 20
Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/basics/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ Let's look at some examples of how the type will change.
pass
```

See more information in the [custom request context](./request#custom-request-context) section.
See more information in the [custom request context](./request.md#custom-request-context) section.

*Added in v23.6*

4 changes: 2 additions & 2 deletions guide/content/en/guide/basics/handlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ In Sanic, a handler is any callable that takes at least a :class:`sanic.request.

Two more important items to note:

1. You almost *never* will want to use :class:`sanic.response.HTTPresponse` directly. It is much simpler to use one of the [convenience methods](./response#methods).
1. You almost *never* will want to use :class:`sanic.response.HTTPresponse` directly. It is much simpler to use one of the [convenience methods](./response.md#methods).

- `from sanic import json`
- `from sanic import html`
- `from sanic import redirect`
- *etc*

1. As we will see in [the streaming section](../advanced/streaming#response-streaming), you do not always need to return an object. If you use this lower-level API, you can control the flow of the response from within the handler, and a return object is not used.
1. As we will see in [the streaming section](../advanced/streaming.md#response-streaming), you do not always need to return an object. If you use this lower-level API, you can control the flow of the response from within the handler, and a return object is not used.

.. tip:: Heads up

Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/basics/headers.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Sanic does attempt to do some normalization on request headers before presenting

### Proxy headers

Sanic has special handling for proxy headers. See the [proxy headers](/guide/advanced/proxy-headers.md) section for more details.
Sanic has special handling for proxy headers. See the [proxy headers](../advanced/proxy-headers.md) section for more details.

### Host header and dynamic URL construction

Expand Down
4 changes: 2 additions & 2 deletions guide/content/en/guide/basics/request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ See API docs: [sanic.request](/api/sanic.request)

The :class:`sanic.request.Request` instance contains **a lot** of helpful information available on its parameters. Refer to the [API documentation](https://sanic.readthedocs.io/) for full details.

As we saw in the section on [handlers](./handlers), the first argument in a route handler is usually the :class:`sanic.request.Request` object. Because Sanic is an async framework, the handler will run inside of a [`asyncio.Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task) and will be scheduled by the event loop. This means that the handler will be executed in an isolated context and the request object will be unique to that handler's task.
As we saw in the section on [handlers](./handlers.md), the first argument in a route handler is usually the :class:`sanic.request.Request` object. Because Sanic is an async framework, the handler will run inside of a [`asyncio.Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task) and will be scheduled by the event loop. This means that the handler will be executed in an isolated context and the request object will be unique to that handler's task.

.. column::

Expand Down Expand Up @@ -185,7 +185,7 @@ As you can see, the `request.ctx` object is a great place to store information t

Often times your API will need to serve multiple concurrent (or consecutive) requests to the same client. This happens, for example, very often with progressive web apps that need to query multiple endpoints to get data.

The HTTP protocol calls for an easing of overhead time caused by the connection with the use of [keep alive headers](../deployment/configuration.md#keep-alive-timeout).
The HTTP protocol calls for an easing of overhead time caused by the connection with the use of [keep alive headers](../running/configuration.md#keep-alive-timeout).

When multiple requests share a single connection, Sanic provides a context object to allow those requests to share state.

Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/basics/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ app.url_for("post_handler", post_id=5, arg_one=["one", "two"], arg_two=2, _ancho
message = await ws.recv()
```

Read the [websockets section](/guide/advanced/websockets.md) to learn more about how they work.
Read the [websockets section](../advanced/websockets.md) to learn more about how they work.

## Strict slashes

Expand Down
6 changes: 3 additions & 3 deletions guide/content/en/guide/best-practices/blueprints.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ In addition, there is a `name_prefix` argument that can be used to make blueprin

.. column::

Which can then be retrieved using `url_for()`. See [routing](/guide/basics/routing.md) for more information.
Which can then be retrieved using `url_for()`. See [routing](../basics/routing.md) for more information.

.. column::

Expand All @@ -332,7 +332,7 @@ In addition, there is a `name_prefix` argument that can be used to make blueprin

.. column::

Blueprints can also implement [listeners](/guide/basics/listeners.md).
Blueprints can also implement [listeners](../basics/listeners.md).

.. column::

Expand All @@ -348,7 +348,7 @@ In addition, there is a `name_prefix` argument that can be used to make blueprin

## Versioning

As discussed in the [versioning section](/guide/advanced/versioning.md), blueprints can be used to implement different versions of a web API.
As discussed in the [versioning section](../advanced/versioning.md), blueprints can be used to implement different versions of a web API.

.. column::

Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/best-practices/exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Sanic comes with three fallback exception handlers:
2. Text
3. JSON

These handlers present differing levels of detail depending upon whether your application is in [debug mode](/guide/deployment/development.md) or not.
These handlers present differing levels of detail depending upon whether your application is in [debug mode](../running/development.md) or not.

By default, Sanic will be in "auto" mode, which means that it will using the incoming request and potential matching handler to choose the appropriate response format. For example, when in a browser it should always provide an HTML error page. When using curl, you might see JSON or plain text.

Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/how-to/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def protected(wrapped):

return decorator(wrapped)
```
This decorator pattern is taken from the [decorators page](/en/guide/best-practices/decorators.md).
This decorator pattern is taken from the [decorators page](../best-practices/decorators.md).

---

Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/running/app-loader.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Running Sanic has been optimized to work with the CLI. If you have not read it y

**Sometimes, this is not enough ... 🤔**

Introduced in [v22.9](../release-notes/v22.9.md), Sanic has an `AppLoader` object that is responsible for creating an application in the various [worker processes](./manager.md#how-sanic-server-starts-processes). You can take advantage of this if you need to create a more dynamic startup experience for your application.
Introduced in [v22.9](../../release-notes/2022/v22.9.md), Sanic has an `AppLoader` object that is responsible for creating an application in the various [worker processes](./manager.md#how-sanic-server-starts-processes). You can take advantage of this if you need to create a more dynamic startup experience for your application.

.. column::

Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/guide/running/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,4 @@ For reference:

## Proxy configuration

See [proxy configuration section](/guide/advanced/proxy-headers.md)
See [proxy configuration section](../advanced/proxy-headers.md)
4 changes: 2 additions & 2 deletions guide/content/en/guide/running/manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ To run a managed custom process on Sanic, you must create a callable. If that pr

### Tracked v. untracked processes

Out of the box, Sanic will track the state of all processes. This means that you can access the state of the process from the [multiplexer](./manager#access-to-the-multiplexer) object, or from the [Inspector](./manager#inspector).
Out of the box, Sanic will track the state of all processes. This means that you can access the state of the process from the [multiplexer](./manager.md#access-to-the-multiplexer) object, or from the [Inspector](./manager.md#inspector).

See [worker state](./manager#worker-state) for more information.
See [worker state](./manager.md#worker-state) for more information.

Sometimes it is helpful to run background processes that are not long-running. You run them once until completion and then they exit. Upon completion, they will either be in `FAILED` or `COMPLETED` state.

Expand Down
4 changes: 2 additions & 2 deletions guide/content/en/guide/running/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ To start HTTP/3, you must explicitly request it when running your application.
app.run(version=3)
```

To run both an HTTP/3 and HTTP/1.1 server simultaneously, you can use [application multi-serve](../release-notes/v22.3.html#application-multi-serve) introduced in v22.3. This will automatically add an [Alt-Svc](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Alt-Svc) header to your HTTP/1.1 requests to let the client know that it is also available as HTTP/3.
To run both an HTTP/3 and HTTP/1.1 server simultaneously, you can use [application multi-serve](../../release-notes/2022/v22.3.md#application-multi-serve) introduced in v22.3. This will automatically add an [Alt-Svc](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Alt-Svc) header to your HTTP/1.1 requests to let the client know that it is also available as HTTP/3.


.. column::
Expand All @@ -442,7 +442,7 @@ To run both an HTTP/3 and HTTP/1.1 server simultaneously, you can use [applicati
Sanic.serve()
```

Because HTTP/3 requires TLS, you cannot start a HTTP/3 server without a TLS certificate. You should [set it up yourself](../how-to/tls.html) or use `mkcert` if in `DEBUG` mode. Currently, automatic TLS setup for HTTP/3 is not compatible with `trustme`. See [development](./development.md) for more details.
Because HTTP/3 requires TLS, you cannot start a HTTP/3 server without a TLS certificate. You should [set it up yourself](../how-to/tls.md) or use `mkcert` if in `DEBUG` mode. Currently, automatic TLS setup for HTTP/3 is not compatible with `trustme`. See [development](./development.md) for more details.

*Added in v22.6*

Expand Down
4 changes: 2 additions & 2 deletions guide/content/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ features:

After installing, Sanic has all the tools you need for a scalable, production-grade server—out of the box!

Including [full TLS support](/en/guide/how-to/tls).
Including [full TLS support](/en/guide/how-to/tls.md).

```python
from sanic import Sanic
Expand Down Expand Up @@ -306,6 +306,6 @@ features:
- **One server** - Develop locally in DEV mode on the same server that will run your PRODUCTION application
- **Auto reload** - Reload running applications every time you save a Python file, but also auto-reload **on any arbitrary directory** like HTML template directories
- **Debugging tools** - Super helpful (and beautiful) [error pages](/en/guide/best-practices/exceptions) that help you traverse the trace stack easily
- **Auto TLS** - Running a localhost website with `https` can be difficult, [Sanic makes it easy](/en/guide/how-to/tls)
- **Auto TLS** - Running a localhost website with `https` can be difficult, [Sanic makes it easy](/en/guide/how-to/tls.md)
- **Streamlined testing** - Built-in testing capabilities, making it easier for developers to create and run tests, ensuring the quality and reliability of their services
- **Modern Python** - Thoughtful use of type hints to help the developer IDE experience
2 changes: 1 addition & 1 deletion guide/content/en/plugins/sanic-ext/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Sanic Extensions - Configuration

# Configuration

Sanic Extensions can be configured in all of the same ways that [you can configure Sanic](../../guide/deployment/configuration.md). That makes configuring Sanic Extensions very easy.
Sanic Extensions can be configured in all of the same ways that [you can configure Sanic](../../guide/running/configuration.md). That makes configuring Sanic Extensions very easy.

```python
app = Sanic("MyApp")
Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/plugins/sanic-ext/convenience.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ title: Sanic Extensions - Convenience
return json({"count": request.count})
```

If possible, the request count will also be added to the [worker state](../../guide/deployment/manager.md#worker-state).
If possible, the request count will also be added to the [worker state](../../guide/running/manager.md#worker-state).

![](https://user-images.githubusercontent.com/166269/190922460-43bd2cfc-f81a-443b-b84f-07b6ce475cbf.png)
4 changes: 2 additions & 2 deletions guide/content/en/plugins/sanic-ext/health-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Sanic Extensions - Health Monitor

The health monitor requires both `sanic>=22.9` and `sanic-ext>=22.9`.

You can setup Sanic Extensions to monitor the health of your worker processes. This requires that you not be in [single process mode](../../guide/deployment/manager.md#single-process-mode).
You can setup Sanic Extensions to monitor the health of your worker processes. This requires that you not be in [single process mode](../../guide/running/manager.md#single-process-mode).

## Setup

Expand All @@ -29,7 +29,7 @@ The monitor sets up a new background process that will periodically receive ackn

.. column::

The health monitor will also enable a diagnostics endpoint that outputs the [worker state](../../guide/deployment/manager.md#worker-state). By default is id disabled.
The health monitor will also enable a diagnostics endpoint that outputs the [worker state](../../guide/running/manager.md#worker-state). By default is id disabled.

.. danger::

Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/plugins/sanic-ext/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Sanic Extensions - Background logger

The background logger requires both `sanic>=22.9` and `sanic-ext>=22.9`.

You can setup Sanic Extensions to log all of your messages from a background process. This requires that you not be in [single process mode](../../guide/deployment/manager.md#single-process-mode).
You can setup Sanic Extensions to log all of your messages from a background process. This requires that you not be in [single process mode](../../guide/running/manager.md#single-process-mode).

Logging can sometimes be an expensive operation. By pushing all logging off to a background process, you can potentially gain some performance benefits.

Expand Down
2 changes: 1 addition & 1 deletion guide/content/en/release-notes/2021/v21.12.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: Version 21.12 (LTS)

## Introduction

This is the final release of the version 21 [release cycle](../../org/policies.md#release-schedule). Version 21 will now enter long-term support and will be supported for two years until December 2023.
This is the final release of the version 21 [release cycle](../../organization/policies.md#release-schedule). Version 21 will now enter long-term support and will be supported for two years until December 2023.

## What to know

Expand Down
6 changes: 3 additions & 3 deletions guide/content/en/release-notes/2021/v21.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Notable new or breaking features, and what to upgrade...

This version drops Python 3.6 support. Version 20.12LTS will continue to support Python 3.6 until its EOL in December, 2022, and version 19.12LTS will support it until its EOL in December, 2021.

Read more about our [LTS policy](../project/policies.md#long-term-support-v-interim-releases).
Read more about our [LTS policy](../../organization/policies.md#long-term-support-v-interim-releases).

### Streaming as first class citizen

The biggest speed improvement came from unifying the request/response cycle into a single flow. Previously, there was a difference between regular cycles, and streaming cycles. This has been simplified under the hood, even though the API is staying the same right now for compatibility. The net benefit is that **all** requests now should see a new benefit.

Read more about [streaming changes](../advanced/streaming.md#response-streaming).
Read more about [streaming changes](../../guide/advanced/streaming.md#response-streaming).

### Router overhaul

Expand Down Expand Up @@ -209,7 +209,7 @@ async def startup_db(app, _):

#### Connection context

When a client sends a keep alive header, Sanic will attempt to keep the transport socket [open for a period of time](../deployment/configuration.md#keep-alive-timeout). That transport object now has a `ctx` object available on it. This effectively means that multiple requests from a single client (where the transport layer is being reused) may share state.
When a client sends a keep alive header, Sanic will attempt to keep the transport socket [open for a period of time](../../guide/running/configuration.md#keep-alive-timeout). That transport object now has a `ctx` object available on it. This effectively means that multiple requests from a single client (where the transport layer is being reused) may share state.

```python
@app.on_request
Expand Down
Loading
Loading