]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Add deployment to Deta, the first gold sponsor 🎉 (#2303)
authorSebastián Ramírez <tiangolo@gmail.com>
Thu, 5 Nov 2020 20:50:37 +0000 (21:50 +0100)
committerGitHub <noreply@github.com>
Thu, 5 Nov 2020 20:50:37 +0000 (21:50 +0100)
* 📝 Add docs for sponsors

* 📝 Add docs for deploying on Deta

* 🍱 Add Deta docs screenshots

* ♻️ Refactor and separate deployment docs

* 📝 Update internal docs links to Deployment

* 📝 Update links in Deta tutorial

* 🍱 Update sponsors images

* 🔧 Use sponsors data from YAML

* 📝 Update sponsors in languages docs

* ✨ Update docs generation scripts

* ✅ Update README.md testing

* 📝 Update main README

* 🔧 Update fastapi-people action handling individual sponsors

* ✏️ Fix typos in Deta tutorial

34 files changed:
.github/actions/people/app/main.py
README.md
docs/en/data/sponsors.yml [new file with mode: 0644]
docs/en/docs/alternatives.md
docs/en/docs/async.md
docs/en/docs/deployment.md [deleted file]
docs/en/docs/deployment/deta.md [new file with mode: 0644]
docs/en/docs/deployment/docker.md [new file with mode: 0644]
docs/en/docs/deployment/https.md [new file with mode: 0644]
docs/en/docs/deployment/index.md [new file with mode: 0644]
docs/en/docs/deployment/manually.md [new file with mode: 0644]
docs/en/docs/deployment/versions.md [new file with mode: 0644]
docs/en/docs/fastapi-people.md
docs/en/docs/img/deployment/deta/image01.png [new file with mode: 0644]
docs/en/docs/img/deployment/deta/image02.png [new file with mode: 0644]
docs/en/docs/img/sponsors/deta.svg [new file with mode: 0644]
docs/en/docs/img/sponsors/testdriven.svg [new file with mode: 0644]
docs/en/docs/index.md
docs/en/mkdocs.yml
docs/es/docs/async.md
docs/es/docs/index.md
docs/fr/docs/index.md
docs/it/docs/index.md
docs/ja/docs/alternatives.md
docs/ja/docs/index.md
docs/ko/docs/index.md
docs/pt/docs/alternatives.md
docs/pt/docs/index.md
docs/ru/docs/index.md
docs/tr/docs/index.md
docs/uk/docs/index.md
docs/zh/docs/index.md
scripts/docs.py
scripts/test.sh

index a4d3af1fd876aa79f106392c989f95cf8be92286..2847ccae4e686f0cc007a3f9b90a014d05fda9c3 100644 (file)
@@ -375,7 +375,7 @@ def get_contributors(settings: Settings):
     return contributors, commentors, reviewers, authors
 
 
-def get_sponsors(settings: Settings):
+def get_individual_sponsors(settings: Settings, max_individual_sponsor: int = 5):
     nodes: List[SponsorshipAsMaintainerNode] = []
     edges = get_graphql_sponsor_edges(settings=settings)
 
@@ -387,6 +387,8 @@ def get_sponsors(settings: Settings):
 
     entities: Dict[str, SponsorEntity] = {}
     for node in nodes:
+        if node.tier.monthlyPriceInDollars > max_individual_sponsor:
+            continue
         entities[node.sponsorEntity.login] = node.sponsorEntity
     return entities
 
@@ -473,7 +475,7 @@ if __name__ == "__main__":
         skip_users=skip_users,
     )
 
-    sponsors_by_login = get_sponsors(settings=settings)
+    sponsors_by_login = get_individual_sponsors(settings=settings)
     sponsors = []
     for login, sponsor in sponsors_by_login.items():
         sponsors.append(
index d0b73f9fc23711ccd166d1dd931e9da050106fa0..67ddcd87b20c3f2197c72ca5bc1632a6d88766be 100644 (file)
--- a/README.md
+++ b/README.md
@@ -43,6 +43,16 @@ The key features are:
 
 <small>* estimation based on tests on an internal development team, building production applications.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+<a href="https://www.deta.sh/?ref=fastapi" target="_blank" title="The launchpad for all your (team's) ideas"><img src="/img/sponsors/deta.svg"></a>
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## Opinions
 
 "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
diff --git a/docs/en/data/sponsors.yml b/docs/en/data/sponsors.yml
new file mode 100644 (file)
index 0000000..931e628
--- /dev/null
@@ -0,0 +1,8 @@
+gold:
+  - url: https://www.deta.sh/?ref=fastapi
+    title: The launchpad for all your (team's) ideas
+    img: /img/sponsors/deta.svg
+silver:
+  - url: https://testdriven.io/
+    title: Learn to build high-quality web apps with best practices
+    img: /img/sponsors/testdriven.svg
index 3d9e3a55af90fb5154394b8f604e80fcb822400f..cec53a4e200cf59679b0e46375a9d51f67a86049 100644 (file)
@@ -410,7 +410,7 @@ It is the recommended server for Starlette and **FastAPI**.
 
     You can combine it with Gunicorn, to have an asynchronous multi-process server.
 
-    Check more details in the [Deployment](deployment.md){.internal-link target=_blank} section.
+    Check more details in the [Deployment](deployment/index.md){.internal-link target=_blank} section.
 
 ## Benchmarks and speed
 
index ac21b3eed284c6a94220f784c0de4da431d2e6c6..7c3dcfdea03a4806cd49dcf7375b57edc8fc24db 100644 (file)
@@ -261,7 +261,7 @@ But you can also exploit the benefits of parallelism and multiprocessing (having
 
 That, plus the simple fact that Python is the main language for **Data Science**, Machine Learning and especially Deep Learning, make FastAPI a very good match for Data Science / Machine Learning web APIs and applications (among many others).
 
-To see how to achieve this parallelism in production see the section about [Deployment](deployment.md){.internal-link target=_blank}.
+To see how to achieve this parallelism in production see the section about [Deployment](deployment/index.md){.internal-link target=_blank}.
 
 ## `async` and `await`
 
diff --git a/docs/en/docs/deployment.md b/docs/en/docs/deployment.md
deleted file mode 100644 (file)
index 5e62d1e..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-# Deployment
-
-Deploying a **FastAPI** application is relatively easy.
-
-There are several ways to do it depending on your specific use case and the tools that you use.
-
-You will see more about some of the ways to do it in the next sections.
-
-## FastAPI versions
-
-**FastAPI** is already being used in production in many applications and systems. And the test coverage is kept at 100%. But its development is still moving quickly.
-
-New features are added frequently, bugs are fixed regularly, and the code is still continuously improving.
-
-That's why the current versions are still `0.x.x`, this reflects that each version could potentially have breaking changes. This follows the <a href="https://semver.org/" class="external-link" target="_blank">Semantic Versioning</a> conventions.
-
-You can create production applications with **FastAPI** right now (and you have probably been doing it for some time), you just have to make sure that you use a version that works correctly with the rest of your code.
-
-### Pin your `fastapi` version
-
-The first thing you should do is to "pin" the version of **FastAPI** you are using to the specific latest version that you know works correctly for your application.
-
-For example, let's say you are using version `0.45.0` in your app.
-
-If you use a `requirements.txt` file you could specify the version with:
-
-```txt
-fastapi==0.45.0
-```
-
-that would mean that you would use exactly the version `0.45.0`.
-
-Or you could also pin it with:
-
-```txt
-fastapi>=0.45.0,<0.46.0
-```
-
-that would mean that you would use the versions `0.45.0` or above, but less than `0.46.0`, for example, a version `0.45.2` would still be accepted.
-
-If you use any other tool to manage your installations, like Poetry, Pipenv, or others, they all have a way that you can use to define specific versions for your packages.
-
-### Available versions
-
-You can see the available versions (e.g. to check what is the current latest) in the [Release Notes](release-notes.md){.internal-link target=_blank}.
-
-### About versions
-
-Following the Semantic Versioning conventions, any version below `1.0.0` could potentially add breaking changes.
-
-FastAPI also follows the convention that any "PATCH" version change is for bug fixes and non-breaking changes.
-
-!!! tip
-    The "PATCH" is the last number, for example, in `0.2.3`, the PATCH version is `3`.
-
-So, you should be able to pin to a version like:
-
-```txt
-fastapi>=0.45.0,<0.46.0
-```
-
-Breaking changes and new features are added in "MINOR" versions.
-
-!!! tip
-    The "MINOR" is the number in the middle, for example, in `0.2.3`, the MINOR version is `2`.
-
-### Upgrading the FastAPI versions
-
-You should add tests for your app.
-
-With **FastAPI** it's very easy (thanks to Starlette), check the docs: [Testing](tutorial/testing.md){.internal-link target=_blank}
-
-After you have tests, then you can upgrade the **FastAPI** version to a more recent one, and make sure that all your code is working correctly by running your tests.
-
-If everything is working, or after you make the necessary changes, and all your tests are passing, then you can pin your `fastapi` to that new recent version.
-
-### About Starlette
-
-You shouldn't pin the version of `starlette`.
-
-Different versions of **FastAPI** will use a specific newer version of Starlette.
-
-So, you can just let **FastAPI** use the correct Starlette version.
-
-### About Pydantic
-
-Pydantic includes the tests for **FastAPI** with its own tests, so new versions of Pydantic (above `1.0.0`) are always compatible with FastAPI.
-
-You can pin Pydantic to any version above `1.0.0` that works for you and below `2.0.0`.
-
-For example:
-
-```txt
-pydantic>=1.2.0,<2.0.0
-```
-
-## Docker
-
-In this section you'll see instructions and links to guides to know how to:
-
-* Make your **FastAPI** application a Docker image/container with maximum performance. In about **5 min**.
-* (Optionally) understand what you, as a developer, need to know about HTTPS.
-* Set up a Docker Swarm mode cluster with automatic HTTPS, even on a simple $5 USD/month server. In about **20 min**.
-* Generate and deploy a full **FastAPI** application, using your Docker Swarm cluster, with HTTPS, etc. In about **10 min**.
-
-You can use <a href="https://www.docker.com/" class="external-link" target="_blank">**Docker**</a> for deployment. It has several advantages like security, replicability, development simplicity, etc.
-
-If you are using Docker, you can use the official Docker image:
-
-### <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" class="external-link" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>
-
-This image has an "auto-tuning" mechanism included, so that you can just add your code and get very high performance automatically. And without making sacrifices.
-
-But you can still change and update all the configurations with environment variables or configuration files.
-
-!!! tip
-    To see all the configurations and options, go to the Docker image page: <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" class="external-link" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>.
-
-### Create a `Dockerfile`
-
-* Go to your project directory.
-* Create a `Dockerfile` with:
-
-```Dockerfile
-FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
-
-COPY ./app /app
-```
-
-#### Bigger Applications
-
-If you followed the section about creating [Bigger Applications with Multiple Files](tutorial/bigger-applications.md){.internal-link target=_blank}, your `Dockerfile` might instead look like:
-
-```Dockerfile
-FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
-
-COPY ./app /app/app
-```
-
-#### Raspberry Pi and other architectures
-
-If you are running Docker in a Raspberry Pi (that has an ARM processor) or any other architecture, you can create a `Dockerfile` from scratch, based on a Python base image (that is multi-architecture) and use Uvicorn alone.
-
-In this case, your `Dockerfile` could look like:
-
-```Dockerfile
-FROM python:3.7
-
-RUN pip install fastapi uvicorn
-
-EXPOSE 80
-
-COPY ./app /app
-
-CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
-```
-
-### Create the **FastAPI** Code
-
-* Create an `app` directory and enter in it.
-* Create a `main.py` file with:
-
-```Python
-from typing import Optional
-
-from fastapi import FastAPI
-
-app = FastAPI()
-
-
-@app.get("/")
-def read_root():
-    return {"Hello": "World"}
-
-
-@app.get("/items/{item_id}")
-def read_item(item_id: int, q: Optional[str] = None):
-    return {"item_id": item_id, "q": q}
-```
-
-* You should now have a directory structure like:
-
-```
-.
-├── app
-│   └── main.py
-└── Dockerfile
-```
-
-### Build the Docker image
-
-* Go to the project directory (in where your `Dockerfile` is, containing your `app` directory).
-* Build your FastAPI image:
-
-<div class="termy">
-
-```console
-$ docker build -t myimage .
-
----> 100%
-```
-
-</div>
-
-### Start the Docker container
-
-* Run a container based on your image:
-
-<div class="termy">
-
-```console
-$ docker run -d --name mycontainer -p 80:80 myimage
-```
-
-</div>
-
-Now you have an optimized FastAPI server in a Docker container. Auto-tuned for your current server (and number of CPU cores).
-
-### Check it
-
-You should be able to check it in your Docker container's URL, for example: <a href="http://192.168.99.100/items/5?q=somequery" class="external-link" target="_blank">http://192.168.99.100/items/5?q=somequery</a> or <a href="http://127.0.0.1/items/5?q=somequery" class="external-link" target="_blank">http://127.0.0.1/items/5?q=somequery</a> (or equivalent, using your Docker host).
-
-You will see something like:
-
-```JSON
-{"item_id": 5, "q": "somequery"}
-```
-
-### Interactive API docs
-
-Now you can go to <a href="http://192.168.99.100/docs" class="external-link" target="_blank">http://192.168.99.100/docs</a> or <a href="http://127.0.0.1/docs" class="external-link" target="_blank">http://127.0.0.1/docs</a> (or equivalent, using your Docker host).
-
-You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>):
-
-![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
-
-### Alternative API docs
-
-And you can also go to <a href="http://192.168.99.100/redoc" class="external-link" target="_blank">http://192.168.99.100/redoc</a> or <a href="http://127.0.0.1/redoc" class="external-link" target="_blank">http://127.0.0.1/redoc</a> (or equivalent, using your Docker host).
-
-You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
-
-![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
-
-## HTTPS
-
-### About HTTPS
-
-It is easy to assume that HTTPS is something that is just "enabled" or not.
-
-But it is way more complex than that.
-
-!!! tip
-    If you are in a hurry or don't care, continue with the next section for step by step instructions to set everything up.
-
-To learn the basics of HTTPS, from a consumer perspective, check <a href="https://howhttps.works/" class="external-link" target="_blank">https://howhttps.works/</a>.
-
-Now, from a developer's perspective, here are several things to have in mind while thinking about HTTPS:
-
-* For HTTPS, the server needs to have "certificates" generated by a third party.
-    * Those certificates are actually acquired from the third-party, not "generated".
-* Certificates have a lifetime.
-    * They expire.
-    * And then they need to be renewed, acquired again from the third party.
-* The encryption of the connection happens at the TCP level.
-    * That's one layer below HTTP.
-    * So, the certificate and encryption handling is done before HTTP.
-* TCP doesn't know about "domains". Only about IP addresses.
-    * The information about the specific domain requested goes in the HTTP data.
-* The HTTPS certificates "certify" a certain domain, but the protocol and encryption happen at the TCP level, before knowing which domain is being dealt with.
-* By default, that would mean that you can only have one HTTPS certificate per IP address.
-    * No matter how big your server is or how small each application you have on it might be.
-    * There is a solution to this, however.
-* There's an extension to the TLS protocol (the one handling the encryption at the TCP level, before HTTP) called <a href="https://en.wikipedia.org/wiki/Server_Name_Indication" class="external-link" target="_blank"><abbr title="Server Name Indication">SNI</abbr></a>.
-    * This SNI extension allows one single server (with a single IP address) to have several HTTPS certificates and serve multiple HTTPS domains/applications.
-    * For this to work, a single component (program) running on the server, listening on the public IP address, must have all the HTTPS certificates in the server.
-* After obtaining a secure connection, the communication protocol is still HTTP.
-    * The contents are encrypted, even though they are being sent with the HTTP protocol.
-
-It is a common practice to have one program/HTTP server running on the server (the machine, host, etc.) and managing all the HTTPS parts : sending the decrypted HTTP requests to the actual HTTP application running in the same server (the **FastAPI** application, in this case), take the HTTP response from the application, encrypt it using the appropriate certificate and sending it back to the client using HTTPS. This server is often called a <a href="https://en.wikipedia.org/wiki/TLS_termination_proxy" class="external-link" target="_blank">TLS Termination Proxy</a>.
-
-### Let's Encrypt
-
-Before Let's Encrypt, these HTTPS certificates were sold by trusted third-parties.
-
-The process to acquire one of these certificates used to be cumbersome, require quite some paperwork and the certificates were quite expensive.
-
-But then <a href="https://letsencrypt.org/" class="external-link" target="_blank">Let's Encrypt</a> was created.
-
-It is a project from the Linux Foundation. It provides HTTPS certificates for free. In an automated way. These certificates use all the standard cryptographic security, and are short lived (about 3 months), so the security is actually better because of their reduced lifespan.
-
-The domains are securely verified and the certificates are generated automatically. This also allows automating the renewal of these certificates.
-
-The idea is to automate the acquisition and renewal of these certificates, so that you can have secure HTTPS, for free, forever.
-
-### Traefik
-
-<a href="https://traefik.io/" class="external-link" target="_blank">Traefik</a> is a high performance reverse proxy / load balancer. It can do the "TLS Termination Proxy" job (apart from other features).
-
-It has integration with Let's Encrypt. So, it can handle all the HTTPS parts, including certificate acquisition and renewal.
-
-It also has integrations with Docker. So, you can declare your domains in each application configurations and have it read those configurations, generate the HTTPS certificates and serve HTTPS to your application automatically, without requiring any change in its configuration.
-
----
-
-With this information and tools, continue with the next section to combine everything.
-
-## Docker Swarm mode cluster with Traefik and HTTPS
-
-You can have a Docker Swarm mode cluster set up in minutes (about 20 min) with a main Traefik handling HTTPS (including certificate acquisition and renewal).
-
-By using Docker Swarm mode, you can start with a "cluster" of a single machine (it can even be a $5 USD / month server) and then you can grow as much as you need adding more servers.
-
-To set up a Docker Swarm Mode cluster with Traefik and HTTPS handling, follow this guide:
-
-### <a href="https://medium.com/@tiangolo/docker-swarm-mode-and-traefik-for-a-https-cluster-20328dba6232" class="external-link" target="_blank">Docker Swarm Mode and Traefik for an HTTPS cluster</a>
-
-### Deploy a FastAPI application
-
-The easiest way to set everything up, would be using the [**FastAPI** Project Generators](project-generation.md){.internal-link target=_blank}.
-
-It is designed to be integrated with this Docker Swarm cluster with Traefik and HTTPS described above.
-
-You can generate a project in about 2 min.
-
-The generated project has instructions to deploy it, doing it takes another 2 min.
-
-## Alternatively, deploy **FastAPI** without Docker
-
-You can deploy **FastAPI** directly without Docker too.
-
-You just need to install an ASGI compatible server like:
-
-=== "Uvicorn"
-
-    * <a href="https://www.uvicorn.org/" class="external-link" target="_blank">Uvicorn</a>, a lightning-fast ASGI server, built on uvloop and httptools.
-
-    <div class="termy">
-
-    ```console
-    $ pip install uvicorn
-
-    ---> 100%
-    ```
-
-    </div>
-
-=== "Hypercorn"
-
-    * <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>, an ASGI server also compatible with HTTP/2.
-
-    <div class="termy">
-
-    ```console
-    $ pip install hypercorn
-
-    ---> 100%
-    ```
-
-    </div>
-
-    ...or any other ASGI server.
-
-And run your application the same way you have done in the tutorials, but without the `--reload` option, e.g.:
-
-=== "Uvicorn"
-
-    <div class="termy">
-
-    ```console
-    $ uvicorn main:app --host 0.0.0.0 --port 80
-
-    <span style="color: green;">INFO</span>:     Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
-    ```
-
-    </div>
-
-=== "Hypercorn"
-
-    <div class="termy">
-
-    ```console
-    $ hypercorn main:app --bind 0.0.0.0:80
-
-    Running on 0.0.0.0:8080 over http (CTRL + C to quit)
-    ```
-
-    </div>
-
-You might want to set up some tooling to make sure it is restarted automatically if it stops.
-
-You might also want to install <a href="https://gunicorn.org/" class="external-link" target="_blank">Gunicorn</a> and <a href="https://www.uvicorn.org/#running-with-gunicorn" class="external-link" target="_blank">use it as a manager for Uvicorn</a>, or use Hypercorn with multiple workers.
-
-Making sure to fine-tune the number of workers, etc.
-
-But if you are doing all that, you might just use the Docker image that does it automatically.
diff --git a/docs/en/docs/deployment/deta.md b/docs/en/docs/deployment/deta.md
new file mode 100644 (file)
index 0000000..ae7a00d
--- /dev/null
@@ -0,0 +1,240 @@
+# Deploy on Deta
+
+In this section you will learn see how to easily deploy a **FastAPI** application on <a href="https://www.deta.sh/?ref=fastapi" class="external-link" target="_blank">Deta</a> using the free plan. 🎁
+
+It will take you about **10 minutes**.
+
+!!! info
+    <a href="https://www.deta.sh/?ref=fastapi" class="external-link" target="_blank">Deta</a> is a **FastAPI** sponsor. 🎉
+
+## A basic **FastAPI** app
+
+* Create a directory for your app, for example `./fastapideta/` and enter in it.
+
+### FastAPI code
+
+* Create a `main.py` file with:
+
+```Python
+from fastapi import FastAPI
+
+app = FastAPI()
+
+
+@app.get("/")
+def read_root():
+    return {"Hello": "World"}
+
+
+@app.get("/items/{item_id}")
+def read_item(item_id: int):
+    return {"item_id": item_id}
+```
+
+### Requirements
+
+Now, in the same directory create a file `requirements.txt` with:
+
+```text
+fastapi
+```
+
+!!! tip
+    You don't need to install Uvicorn to deploy on Deta, although you would probably want to install it locally to test your app.
+
+### Directory structure
+
+You will now have one directory `./fastapideta/` with two files:
+
+```
+.
+└── main.py
+└── requirements.txt
+```
+
+## Create a free Deta account
+
+Now create a <a href="https://www.deta.sh/?ref=fastapi" class="external-link" target="_blank">free account on Deta</a>, you just need an email and password.
+
+You don't even need a credit card.
+
+## Install the CLI
+
+Once you have your account, install the Deta <abbr title="Command Line Interface application">CLI</abbr>:
+
+=== "Linux, macOS"
+
+    <div class="termy">
+
+    ```console
+    $ curl -fsSL https://get.deta.dev/cli.sh | sh
+    ```
+
+    </div>
+
+=== "Windows PowerShell"
+
+    <div class="termy">
+
+    ```console
+    $ iwr https://get.deta.dev/cli.ps1 -useb | iex
+    ```
+
+    </div>
+
+After installing it, open a new terminal so that the installed CLI is detected.
+
+In a new terminal, confirm that it was correctly installed with:
+
+<div class="termy">
+
+```console
+$ deta --help
+
+Deta command line interface for managing deta micros.
+Complete documentation available at https://docs.deta.sh
+
+Usage:
+  deta [flags]
+  deta [command]
+
+Available Commands:
+  auth        Change auth settings for a deta micro
+
+...
+```
+
+</div>
+
+!!! tip
+    If you have problems installing the CLI, check the <a href="https://docs.deta.sh/docs/micros/getting_started?ref=fastapi" class="external-link" target="_blank">official Deta docs</a>.
+
+## Login with the CLI
+
+Now login to Deta from the CLI with:
+
+<div class="termy">
+
+```console
+$ deta login
+
+Please, log in from the web page. Waiting..
+Logged in successfully.
+```
+
+</div>
+
+This will open a web browser and authenticate automatically.
+
+## Deploy with Deta
+
+Next, deploy your application with the Deta CLI:
+
+<div class="termy">
+
+```console
+$ deta new
+
+Successfully created a new micro
+
+// Notice the "endpoint" 🔍
+
+{
+    "name": "fastapideta",
+    "runtime": "python3.7",
+    "endpoint": "https://qltnci.deta.dev",
+    "visor": "enabled",
+    "http_auth": "enabled"
+}
+
+Adding dependencies...
+
+
+---> 100%
+
+
+Successfully installed fastapi-0.61.1 pydantic-1.7.2 starlette-0.13.6
+```
+
+</div>
+
+You will see a JSON message similar to:
+
+```JSON hl_lines="4"
+{
+        "name": "fastapideta",
+        "runtime": "python3.7",
+        "endpoint": "https://qltnci.deta.dev",
+        "visor": "enabled",
+        "http_auth": "enabled"
+}
+```
+
+!!! tip
+    Your deployment will have a different `"endpoint"` URL.
+
+## Check it
+
+Now open your browser in your `endpoint` URL. In the example above it was `https://qltnci.deta.dev`, but yours will be different.
+
+You will see the JSON response from your FastAPI app:
+
+```JSON
+{
+    "Hello": "World"
+}
+```
+
+And now go to the `/docs` for your API, in the example above it would be `https://qltnci.deta.dev/docs`.
+
+It will show your docs like:
+
+<img src="/img/deployment/deta/image01.png">
+
+## Enable public access
+
+By default, Deta will handle authentication using cookies for your account.
+
+But once you are ready, you can make it public with:
+
+<div class="termy">
+
+```console
+$ deta auth disable
+
+Successfully disabled http auth
+```
+
+</div>
+
+Now you can share that URL with anyone and they will be able to access your API. 🚀
+
+## HTTPS
+
+Congrats! You deployed your FastAPI app to Deta! 🎉 🍰
+
+Also notice that Deta correctly handles HTTPS for you, so you don't have to take care of that and can be sure that your clients will have a secure encrypted connection. ✅ 🔒
+
+## Check the Visor
+
+From your docs UI (they will be in a URL like `https://qltnci.deta.dev/docs`) send a request to your *path operation* `/items/{item_id}`.
+
+For example with ID `5`.
+
+Now go to <a href="https://web.deta.sh/" class="external-link" target="_blank">https://web.deta.sh</a>.
+
+You will see there's a section to the left called <abbr title="it comes from Micro(server)">"Micros"</abbr> with each of your apps.
+
+You will see a tab with "Details", and also a tab "Visor", go to the tab "Visor".
+
+In there you can inspect the recent requests sent to your app.
+
+You can also edit them and re-play them.
+
+<img src="/img/deployment/deta/image02.png">
+
+## Learn more
+
+At some point you will probably want to store some data for your app in a way that persists through time. For that you can use <a href="https://docs.deta.sh/docs/base/py_tutorial?ref=fastapi" class="external-link" target="_blank">Deta Base</a>, it also has a generous **free tier**.
+
+You can also read more in the <a href="https://docs.deta.sh?ref=fastapi" class="external-link" target="_blank">Deta Docs</a>.
diff --git a/docs/en/docs/deployment/docker.md b/docs/en/docs/deployment/docker.md
new file mode 100644 (file)
index 0000000..e32a296
--- /dev/null
@@ -0,0 +1,179 @@
+# Deploy with Docker
+
+In this section you'll see instructions and links to guides to know how to:
+
+* Make your **FastAPI** application a Docker image/container with maximum performance. In about **5 min**.
+* (Optionally) understand what you, as a developer, need to know about HTTPS.
+* Set up a Docker Swarm mode cluster with automatic HTTPS, even on a simple $5 USD/month server. In about **20 min**.
+* Generate and deploy a full **FastAPI** application, using your Docker Swarm cluster, with HTTPS, etc. In about **10 min**.
+
+You can use <a href="https://www.docker.com/" class="external-link" target="_blank">**Docker**</a> for deployment. It has several advantages like security, replicability, development simplicity, etc.
+
+If you are using Docker, you can use the official Docker image:
+
+## <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" class="external-link" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>
+
+This image has an "auto-tuning" mechanism included, so that you can just add your code and get very high performance automatically. And without making sacrifices.
+
+But you can still change and update all the configurations with environment variables or configuration files.
+
+!!! tip
+    To see all the configurations and options, go to the Docker image page: <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" class="external-link" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>.
+
+## Create a `Dockerfile`
+
+* Go to your project directory.
+* Create a `Dockerfile` with:
+
+```Dockerfile
+FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
+
+COPY ./app /app
+```
+
+### Bigger Applications
+
+If you followed the section about creating [Bigger Applications with Multiple Files](../tutorial/bigger-applications.md){.internal-link target=_blank}, your `Dockerfile` might instead look like:
+
+```Dockerfile
+FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
+
+COPY ./app /app/app
+```
+
+### Raspberry Pi and other architectures
+
+If you are running Docker in a Raspberry Pi (that has an ARM processor) or any other architecture, you can create a `Dockerfile` from scratch, based on a Python base image (that is multi-architecture) and use Uvicorn alone.
+
+In this case, your `Dockerfile` could look like:
+
+```Dockerfile
+FROM python:3.7
+
+RUN pip install fastapi uvicorn
+
+EXPOSE 80
+
+COPY ./app /app
+
+CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
+```
+
+## Create the **FastAPI** Code
+
+* Create an `app` directory and enter in it.
+* Create a `main.py` file with:
+
+```Python
+from typing import Optional
+
+from fastapi import FastAPI
+
+app = FastAPI()
+
+
+@app.get("/")
+def read_root():
+    return {"Hello": "World"}
+
+
+@app.get("/items/{item_id}")
+def read_item(item_id: int, q: Optional[str] = None):
+    return {"item_id": item_id, "q": q}
+```
+
+* You should now have a directory structure like:
+
+```
+.
+├── app
+│   └── main.py
+└── Dockerfile
+```
+
+## Build the Docker image
+
+* Go to the project directory (in where your `Dockerfile` is, containing your `app` directory).
+* Build your FastAPI image:
+
+<div class="termy">
+
+```console
+$ docker build -t myimage .
+
+---> 100%
+```
+
+</div>
+
+## Start the Docker container
+
+* Run a container based on your image:
+
+<div class="termy">
+
+```console
+$ docker run -d --name mycontainer -p 80:80 myimage
+```
+
+</div>
+
+Now you have an optimized FastAPI server in a Docker container. Auto-tuned for your current server (and number of CPU cores).
+
+## Check it
+
+You should be able to check it in your Docker container's URL, for example: <a href="http://192.168.99.100/items/5?q=somequery" class="external-link" target="_blank">http://192.168.99.100/items/5?q=somequery</a> or <a href="http://127.0.0.1/items/5?q=somequery" class="external-link" target="_blank">http://127.0.0.1/items/5?q=somequery</a> (or equivalent, using your Docker host).
+
+You will see something like:
+
+```JSON
+{"item_id": 5, "q": "somequery"}
+```
+
+## Interactive API docs
+
+Now you can go to <a href="http://192.168.99.100/docs" class="external-link" target="_blank">http://192.168.99.100/docs</a> or <a href="http://127.0.0.1/docs" class="external-link" target="_blank">http://127.0.0.1/docs</a> (or equivalent, using your Docker host).
+
+You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>):
+
+![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
+
+## Alternative API docs
+
+And you can also go to <a href="http://192.168.99.100/redoc" class="external-link" target="_blank">http://192.168.99.100/redoc</a> or <a href="http://127.0.0.1/redoc" class="external-link" target="_blank">http://127.0.0.1/redoc</a> (or equivalent, using your Docker host).
+
+You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
+
+![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
+
+## Traefik
+
+<a href="https://traefik.io/" class="external-link" target="_blank">Traefik</a> is a high performance reverse proxy / load balancer. It can do the "TLS Termination Proxy" job (apart from other features).
+
+It has integration with Let's Encrypt. So, it can handle all the HTTPS parts, including certificate acquisition and renewal.
+
+It also has integrations with Docker. So, you can declare your domains in each application configurations and have it read those configurations, generate the HTTPS certificates and serve HTTPS to your application automatically, without requiring any change in its configuration.
+
+---
+
+With this information and tools, continue with the next section to combine everything.
+
+## Docker Swarm mode cluster with Traefik and HTTPS
+
+You can have a Docker Swarm mode cluster set up in minutes (about 20 min) with a main Traefik handling HTTPS (including certificate acquisition and renewal).
+
+By using Docker Swarm mode, you can start with a "cluster" of a single machine (it can even be a $5 USD / month server) and then you can grow as much as you need adding more servers.
+
+To set up a Docker Swarm Mode cluster with Traefik and HTTPS handling, follow this guide:
+
+### <a href="https://medium.com/@tiangolo/docker-swarm-mode-and-traefik-for-a-https-cluster-20328dba6232" class="external-link" target="_blank">Docker Swarm Mode and Traefik for an HTTPS cluster</a>
+
+### Deploy a FastAPI application
+
+The easiest way to set everything up, would be using the [**FastAPI** Project Generators](../project-generation.md){.internal-link target=_blank}.
+
+It is designed to be integrated with this Docker Swarm cluster with Traefik and HTTPS described above.
+
+You can generate a project in about 2 min.
+
+The generated project has instructions to deploy it, doing it takes another 2 min.
diff --git a/docs/en/docs/deployment/https.md b/docs/en/docs/deployment/https.md
new file mode 100644 (file)
index 0000000..c735f1f
--- /dev/null
@@ -0,0 +1,48 @@
+# About HTTPS
+
+It is easy to assume that HTTPS is something that is just "enabled" or not.
+
+But it is way more complex than that.
+
+!!! tip
+    If you are in a hurry or don't care, continue with the next sections for step by step instructions to set everything up with different techniques.
+
+To learn the basics of HTTPS, from a consumer perspective, check <a href="https://howhttps.works/" class="external-link" target="_blank">https://howhttps.works/</a>.
+
+Now, from a developer's perspective, here are several things to have in mind while thinking about HTTPS:
+
+* For HTTPS, the server needs to have "certificates" generated by a third party.
+    * Those certificates are actually acquired from the third-party, not "generated".
+* Certificates have a lifetime.
+    * They expire.
+    * And then they need to be renewed, acquired again from the third party.
+* The encryption of the connection happens at the TCP level.
+    * That's one layer below HTTP.
+    * So, the certificate and encryption handling is done before HTTP.
+* TCP doesn't know about "domains". Only about IP addresses.
+    * The information about the specific domain requested goes in the HTTP data.
+* The HTTPS certificates "certify" a certain domain, but the protocol and encryption happen at the TCP level, before knowing which domain is being dealt with.
+* By default, that would mean that you can only have one HTTPS certificate per IP address.
+    * No matter how big your server is or how small each application you have on it might be.
+    * There is a solution to this, however.
+* There's an extension to the TLS protocol (the one handling the encryption at the TCP level, before HTTP) called <a href="https://en.wikipedia.org/wiki/Server_Name_Indication" class="external-link" target="_blank"><abbr title="Server Name Indication">SNI</abbr></a>.
+    * This SNI extension allows one single server (with a single IP address) to have several HTTPS certificates and serve multiple HTTPS domains/applications.
+    * For this to work, a single component (program) running on the server, listening on the public IP address, must have all the HTTPS certificates in the server.
+* After obtaining a secure connection, the communication protocol is still HTTP.
+    * The contents are encrypted, even though they are being sent with the HTTP protocol.
+
+It is a common practice to have one program/HTTP server running on the server (the machine, host, etc.) and managing all the HTTPS parts : sending the decrypted HTTP requests to the actual HTTP application running in the same server (the **FastAPI** application, in this case), take the HTTP response from the application, encrypt it using the appropriate certificate and sending it back to the client using HTTPS. This server is often called a <a href="https://en.wikipedia.org/wiki/TLS_termination_proxy" class="external-link" target="_blank">TLS Termination Proxy</a>.
+
+## Let's Encrypt
+
+Before Let's Encrypt, these HTTPS certificates were sold by trusted third-parties.
+
+The process to acquire one of these certificates used to be cumbersome, require quite some paperwork and the certificates were quite expensive.
+
+But then <a href="https://letsencrypt.org/" class="external-link" target="_blank">Let's Encrypt</a> was created.
+
+It is a project from the Linux Foundation. It provides HTTPS certificates for free. In an automated way. These certificates use all the standard cryptographic security, and are short lived (about 3 months), so the security is actually better because of their reduced lifespan.
+
+The domains are securely verified and the certificates are generated automatically. This also allows automating the renewal of these certificates.
+
+The idea is to automate the acquisition and renewal of these certificates, so that you can have secure HTTPS, for free, forever.
diff --git a/docs/en/docs/deployment/index.md b/docs/en/docs/deployment/index.md
new file mode 100644 (file)
index 0000000..d898cfe
--- /dev/null
@@ -0,0 +1,7 @@
+# Deployment - Intro
+
+Deploying a **FastAPI** application is relatively easy.
+
+There are several ways to do it depending on your specific use case and the tools that you use.
+
+You will see more details to have in mind and some of the techniques to do it in the next sections.
diff --git a/docs/en/docs/deployment/manually.md b/docs/en/docs/deployment/manually.md
new file mode 100644 (file)
index 0000000..4051241
--- /dev/null
@@ -0,0 +1,69 @@
+# Deploy manually
+
+You can deploy **FastAPI** manually as well.
+
+You just need to install an ASGI compatible server like:
+
+=== "Uvicorn"
+
+    * <a href="https://www.uvicorn.org/" class="external-link" target="_blank">Uvicorn</a>, a lightning-fast ASGI server, built on uvloop and httptools.
+
+    <div class="termy">
+
+    ```console
+    $ pip install uvicorn
+
+    ---> 100%
+    ```
+
+    </div>
+
+=== "Hypercorn"
+
+    * <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>, an ASGI server also compatible with HTTP/2.
+
+    <div class="termy">
+
+    ```console
+    $ pip install hypercorn
+
+    ---> 100%
+    ```
+
+    </div>
+
+    ...or any other ASGI server.
+
+And run your application the same way you have done in the tutorials, but without the `--reload` option, e.g.:
+
+=== "Uvicorn"
+
+    <div class="termy">
+
+    ```console
+    $ uvicorn main:app --host 0.0.0.0 --port 80
+
+    <span style="color: green;">INFO</span>:     Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
+    ```
+
+    </div>
+
+=== "Hypercorn"
+
+    <div class="termy">
+
+    ```console
+    $ hypercorn main:app --bind 0.0.0.0:80
+
+    Running on 0.0.0.0:8080 over http (CTRL + C to quit)
+    ```
+
+    </div>
+
+You might want to set up some tooling to make sure it is restarted automatically if it stops.
+
+You might also want to install <a href="https://gunicorn.org/" class="external-link" target="_blank">Gunicorn</a> and <a href="https://www.uvicorn.org/#running-with-gunicorn" class="external-link" target="_blank">use it as a manager for Uvicorn</a>, or use Hypercorn with multiple workers.
+
+Making sure to fine-tune the number of workers, etc.
+
+But if you are doing all that, you might just use the Docker image that does it automatically.
diff --git a/docs/en/docs/deployment/versions.md b/docs/en/docs/deployment/versions.md
new file mode 100644 (file)
index 0000000..4be9385
--- /dev/null
@@ -0,0 +1,87 @@
+# About FastAPI versions
+
+**FastAPI** is already being used in production in many applications and systems. And the test coverage is kept at 100%. But its development is still moving quickly.
+
+New features are added frequently, bugs are fixed regularly, and the code is still continuously improving.
+
+That's why the current versions are still `0.x.x`, this reflects that each version could potentially have breaking changes. This follows the <a href="https://semver.org/" class="external-link" target="_blank">Semantic Versioning</a> conventions.
+
+You can create production applications with **FastAPI** right now (and you have probably been doing it for some time), you just have to make sure that you use a version that works correctly with the rest of your code.
+
+## Pin your `fastapi` version
+
+The first thing you should do is to "pin" the version of **FastAPI** you are using to the specific latest version that you know works correctly for your application.
+
+For example, let's say you are using version `0.45.0` in your app.
+
+If you use a `requirements.txt` file you could specify the version with:
+
+```txt
+fastapi==0.45.0
+```
+
+that would mean that you would use exactly the version `0.45.0`.
+
+Or you could also pin it with:
+
+```txt
+fastapi>=0.45.0,<0.46.0
+```
+
+that would mean that you would use the versions `0.45.0` or above, but less than `0.46.0`, for example, a version `0.45.2` would still be accepted.
+
+If you use any other tool to manage your installations, like Poetry, Pipenv, or others, they all have a way that you can use to define specific versions for your packages.
+
+## Available versions
+
+You can see the available versions (e.g. to check what is the current latest) in the [Release Notes](../release-notes.md){.internal-link target=_blank}.
+
+## About versions
+
+Following the Semantic Versioning conventions, any version below `1.0.0` could potentially add breaking changes.
+
+FastAPI also follows the convention that any "PATCH" version change is for bug fixes and non-breaking changes.
+
+!!! tip
+    The "PATCH" is the last number, for example, in `0.2.3`, the PATCH version is `3`.
+
+So, you should be able to pin to a version like:
+
+```txt
+fastapi>=0.45.0,<0.46.0
+```
+
+Breaking changes and new features are added in "MINOR" versions.
+
+!!! tip
+    The "MINOR" is the number in the middle, for example, in `0.2.3`, the MINOR version is `2`.
+
+## Upgrading the FastAPI versions
+
+You should add tests for your app.
+
+With **FastAPI** it's very easy (thanks to Starlette), check the docs: [Testing](../tutorial/testing.md){.internal-link target=_blank}
+
+After you have tests, then you can upgrade the **FastAPI** version to a more recent one, and make sure that all your code is working correctly by running your tests.
+
+If everything is working, or after you make the necessary changes, and all your tests are passing, then you can pin your `fastapi` to that new recent version.
+
+## About Starlette
+
+You shouldn't pin the version of `starlette`.
+
+Different versions of **FastAPI** will use a specific newer version of Starlette.
+
+So, you can just let **FastAPI** use the correct Starlette version.
+
+## About Pydantic
+
+Pydantic includes the tests for **FastAPI** with its own tests, so new versions of Pydantic (above `1.0.0`) are always compatible with FastAPI.
+
+You can pin Pydantic to any version above `1.0.0` that works for you and below `2.0.0`.
+
+For example:
+
+```txt
+pydantic>=1.2.0,<2.0.0
+```
index 80b225efd0cc2b6526f72816dafffed9b6fcca74..42148c1f55beee66a412a6647a2e8cf40dedd3f5 100644 (file)
@@ -112,7 +112,25 @@ The **Top Reviewers** 🕵️ have reviewed the most Pull Requests from others,
 
 These are the **Sponsors**. 😎
 
-They are supporting my work with **FastAPI** (and others) through <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>.
+They are supporting my work with **FastAPI** (and others), mainly through <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>.
+
+### Gold Sponsors
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+### Silver Sponsors
+
+{% if sponsors %}
+{% for sponsor in sponsors.silver -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+### Individual Sponsors
 
 {% if people %}
 <div class="user-list user-list-center">
@@ -126,10 +144,12 @@ They are supporting my work with **FastAPI** (and others) through <a href="https
 
 ## About the data - technical details
 
-The intention of this page is to highlight the effort of the community to help others.
+The main intention of this page is to highlight the effort of the community to help others.
 
 Especially including efforts that are normally less visible, and in many cases more arduous, like helping others with issues and reviewing Pull Requests with translations.
 
 The data is calculated each month, you can read the <a href="https://github.com/tiangolo/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">source code here</a>.
 
+Here I'm also highlighting contributions from sponsors.
+
 I also reserve the right to update the algorithm, sections, thresholds, etc (just in case 🤷).
diff --git a/docs/en/docs/img/deployment/deta/image01.png b/docs/en/docs/img/deployment/deta/image01.png
new file mode 100644 (file)
index 0000000..f2e058b
Binary files /dev/null and b/docs/en/docs/img/deployment/deta/image01.png differ
diff --git a/docs/en/docs/img/deployment/deta/image02.png b/docs/en/docs/img/deployment/deta/image02.png
new file mode 100644 (file)
index 0000000..897ec41
Binary files /dev/null and b/docs/en/docs/img/deployment/deta/image02.png differ
diff --git a/docs/en/docs/img/sponsors/deta.svg b/docs/en/docs/img/sponsors/deta.svg
new file mode 100644 (file)
index 0000000..c2b77a8
--- /dev/null
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   width="240"
+   height="100"
+   viewBox="0 0 240 100"
+   fill="none"
+   version="1.1"
+   id="svg19">
+  <metadata
+     id="metadata23">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs17">
+    <rect
+       x="-491.25317"
+       y="-261.21402"
+       width="476.65652"
+       height="212.95724"
+       id="rect1716" />
+    <clipPath
+       id="clip0">
+      <rect
+         width="770"
+         height="222.03999"
+         fill="#ffffff"
+         id="rect14"
+         x="0"
+         y="0" />
+    </clipPath>
+  </defs>
+  <text
+     xml:space="preserve"
+     id="text1714"
+     style="font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect1716);"
+     transform="translate(44.332916,-25.667084)" />
+  <rect
+     style="fill:#ffffff;stroke:none;stroke-width:1.60003;stop-color:#000000"
+     id="rect1756"
+     width="240"
+     height="100"
+     x="0"
+     y="0" />
+  <rect
+     style="fill:#ffffff;stroke:none;stroke-width:1.52703;stop-color:#000000"
+     id="rect1758"
+     width="230"
+     height="90"
+     x="5"
+     y="5" />
+  <text
+     xml:space="preserve"
+     style="font-size:16px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;stroke-width:0.489974"
+     x="5.046875"
+     y="81.521378"
+     id="text1712"><tspan
+       id="tspan1710"
+       x="5.046875"
+       y="81.521378"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:16px;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.489974">Deploy your FastAPI app for free</tspan></text>
+  <g
+     clip-path="url(#clip0)"
+     id="g12"
+     transform="matrix(0.19133908,0,0,0.19133908,46.334454,11.992465)">
+    <path
+       d="m 111.14,0 c 61.38,0 111.139,49.7054 111.139,111.02 0,61.315 -49.759,111.02 -111.139,111.02 C 49.7589,222.04 0,172.335 0,111.02 0,49.7054 49.7589,0 111.14,0 Z"
+       fill="#ef39a8"
+       id="path2" />
+    <path
+       d="m 111.404,21.6757 c 49.689,0 89.97,40.2376 89.97,89.8733 0,49.636 -40.281,89.873 -89.97,89.873 -49.689,0 -89.9702,-40.237 -89.9702,-89.873 0,-49.6357 40.2812,-89.8733 89.9702,-89.8733 z"
+       fill="#bd399c"
+       id="path4" />
+    <path
+       d="m 111.404,45.4653 c 36.536,0 66.154,29.5861 66.154,66.0837 0,36.497 -29.618,66.083 -66.154,66.083 -36.536,0 -66.154,-29.586 -66.154,-66.083 0,-36.4976 29.618,-66.0837 66.154,-66.0837 z"
+       fill="#93388e"
+       id="path6" />
+    <path
+       d="m 110.874,65.5554 c 24.844,0 44.985,20.1184 44.985,44.9366 0,24.817 -20.141,44.936 -44.985,44.936 -24.8437,0 -44.9846,-20.119 -44.9846,-44.936 0,-24.8182 20.1409,-44.9366 44.9846,-44.9366 z"
+       fill="#6030a2"
+       id="path8" />
+    <path
+       d="m 339,170.836 h 49.915 c 23.004,0 40.365,-5.842 51.867,-17.745 11.719,-11.902 17.579,-25.752 17.579,-41.983 0,-16.2301 -5.86,-30.2964 -17.579,-42.1987 C 429.28,57.007 411.919,51.1641 388.915,51.1641 H 339 Z m 96.574,-59.728 c 0,11.686 -3.907,21.641 -11.719,29.864 -7.596,8.007 -19.315,12.119 -34.94,12.119 H 361.136 V 68.9093 h 27.779 c 15.625,0 27.344,4.1117 34.94,12.1186 7.812,8.2235 11.719,18.1781 11.719,30.0801 z m 40.582,10.388 c 0,30.08 19.098,51.504 52.302,51.504 22.136,0 39.931,-10.604 47.744,-30.513 h -24.523 c -5.426,8.44 -13.022,12.768 -23.221,12.768 -16.928,0 -27.778,-10.82 -29.732,-27.7 h 79.212 v -6.059 c 0,-29.6478 -19.966,-51.5047 -50.782,-51.5047 -31.034,0 -51,21.2077 -51,51.5047 z m 78.995,-8.224 h -56.208 c 2.388,-14.9316 11.936,-25.5355 28.213,-25.5355 15.843,0 25.608,10.3875 27.995,25.5355 z m 73.353,20.992 V 88.3857 h 24.957 V 72.1553 H 628.504 V 49 h -21.702 v 23.1553 h -16.06 v 16.2304 h 16.06 v 45.8783 c 0,14.499 3.038,24.237 9.332,29.431 6.293,5.193 15.191,7.79 26.693,7.79 3.69,0 6.944,-0.216 9.766,-0.865 l 4.123,-0.866 v -17.096 l -4.123,0.433 c -2.822,0.433 -6.076,0.649 -9.766,0.649 -11.719,0 -14.323,-6.059 -14.323,-19.476 z m 93.101,-63.6235 c -14.54,0 -25.825,3.0297 -33.638,9.3055 -8.029,6.2757 -11.936,13.8499 -11.936,22.723 h 22.136 c 0,-10.3879 11.719,-14.2833 23.438,-14.2833 14.757,0 23.872,5.1937 23.872,18.8273 v 6.059 h -26.693 c -26.259,0 -46.659,6.709 -46.659,28.782 0,20.342 15.625,30.946 38.847,30.946 14.973,0 25.607,-3.679 31.901,-11.037 l 3.039,-3.678 c 0,4.111 1.735,10.387 2.386,12.551 H 770 v -1.731 l -1.519,-4.761 c -0.868,-3.246 -1.302,-8.223 -1.302,-15.148 v -38.088 c 0,-28.998 -16.493,-40.4675 -45.574,-40.4675 z m 23.872,57.1305 c 0,19.693 -9.982,29.864 -28.863,29.864 -12.37,0 -22.354,-4.111 -22.354,-14.499 0,-11.902 10.852,-15.365 24.524,-15.581 z"
+       fill="#000000"
+       id="path10" />
+  </g>
+</svg>
diff --git a/docs/en/docs/img/sponsors/testdriven.svg b/docs/en/docs/img/sponsors/testdriven.svg
new file mode 100644 (file)
index 0000000..9ed2dc7
--- /dev/null
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="63.5mm"
+   height="26.458334mm"
+   viewBox="0 0 63.5 26.458334"
+   version="1.1"
+   id="svg975"
+   inkscape:version="1.0.1 (1.0.1+r73)"
+   sodipodi:docname="testdriven.svg">
+  <defs
+     id="defs969">
+    <clipPath
+       id="clip0">
+      <rect
+         width="770"
+         height="222.03999"
+         fill="#ffffff"
+         id="rect14"
+         x="0"
+         y="0" />
+    </clipPath>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="2"
+     inkscape:cx="133.05705"
+     inkscape:cy="115.91792"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     inkscape:document-rotation="0"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1025"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata972">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-75.455132,-135.96141)">
+    <rect
+       style="fill:#212529;fill-opacity:1;stroke:none;stroke-width:0.364576;stop-color:#000000"
+       id="rect901"
+       width="63.5"
+       height="26.458334"
+       x="75.455132"
+       y="135.96141" />
+    <rect
+       style="fill:#212529;fill-opacity:1;stroke:none;stroke-width:0.404023;stop-color:#000000"
+       id="rect1758"
+       width="60.854168"
+       height="23.8125"
+       x="76.778053"
+       y="137.28433" />
+    <g
+       id="g1648"
+       transform="matrix(0.40937885,0,0,0.40937885,80.597548,138.01872)">
+      <path
+         d="M 1.6,4.62 3.2,5.54 11.19,0.92 9.59,0 Z m 9.59,-3.7 1.6,-0.92 8,4.62 -1.6,0.92 z m 9.6,5.54 -1.6,-0.92 -8,4.61 1.6,0.93 z m -9.6,3.69 -1.6,0.93 L 1.6,6.46 3.2,5.54 Z"
+         fill="#d2edf3"
+         id="path1538" />
+      <path
+         d="m 11.19,23.08 1.6,-0.93 v -9.23 l -1.6,0.93 z m 1.6,-10.16 v -1.84 l 8,-4.62 v 1.85 z m 9.59,-5.54 -1.59,0.93 -0.01,9.23 1.6,-0.93 z m -1.6,10.16 v 1.84 L 12.79,24 v -1.85 z"
+         fill="#76cede"
+         id="path1540" />
+      <path
+         d="m 11.19,23.08 -1.6,-0.93 v -9.23 l 1.6,0.93 z M 9.59,12.92 V 11.08 L 1.6,6.46 V 8.31 Z M 0,7.38 1.6,8.31 v 9.23 L 0,16.61 Z m 1.6,10.16 v 1.84 L 9.59,24 v -1.85 z"
+         fill="#339999"
+         id="path1542" />
+      <path
+         d="m 11.19,10.15 -1.6,0.93 v 1.84 L 11.19,12 Z"
+         fill="#76cede"
+         id="path1544" />
+      <path
+         d="m 9.59,12.92 1.6,0.93 1.6,-0.93 -1.6,-0.92 z"
+         fill="#d2edf3"
+         id="path1546" />
+      <path
+         d="M 11.19,10.15 V 12 l 1.6,0.92 v -1.84 z"
+         fill="#339999"
+         id="path1548" />
+      <path
+         d="m 20.78,17.54 -1.6,-0.92 -6.39,3.69 v 1.85 z m -19.18,0 1.6,-0.92 6.39,3.69 v 1.85 z"
+         fill="#d2edf3"
+         id="path1550" />
+      <path
+         d="m 1.6,8.31 1.6,0.92 v 7.38 l -1.6,0.93 z"
+         fill="#76cede"
+         id="path1552" />
+      <path
+         d="m 20.79,8.31 -1.6,0.92 v 7.38 l 1.59,0.93 z"
+         fill="#339999"
+         id="path1554" />
+      <path
+         d="M 11.19,0.92 V 2.77 L 4.8,6.46 3.2,5.54 Z"
+         fill="#76cede"
+         id="path1556" />
+      <path
+         d="m 11.19,0.92 v 1.85 l 6.39,3.69 1.61,-0.92 z"
+         fill="#339999"
+         id="path1558" />
+      <path
+         d="m 4.8,13.85 -1.6,0.92 v 1.84 l 1.6,-0.92 z"
+         fill="#d2edf3"
+         id="path1560" />
+      <path
+         d="M 3.2,16.61 4.8,17.54 6.4,16.61 4.8,15.69 Z"
+         fill="#76cede"
+         id="path1562" />
+      <path
+         d="m 4.8,13.85 v 1.84 l 1.6,0.92 v -1.84 z"
+         fill="#339999"
+         id="path1564" />
+      <path
+         d="m 9.59,5.54 1.6,0.92 1.6,-0.92 -1.6,-0.93 z"
+         fill="#d2edf3"
+         id="path1566" />
+      <path
+         d="M 12.79,5.54 V 3.69 l -1.6,-0.92 v 1.84 z"
+         fill="#76cede"
+         id="path1568" />
+      <path
+         d="m 9.59,5.54 1.6,-0.93 V 2.77 l -1.6,0.92 z"
+         fill="#339999"
+         id="path1570" />
+      <path
+         d="m 15.99,16.61 1.6,0.93 1.6,-0.93 -1.6,-0.92 z"
+         fill="#76cede"
+         id="path1572" />
+      <path
+         d="m 19.19,16.61 v -1.84 l -1.6,-0.92 v 1.84 z"
+         fill="#d2edf3"
+         id="path1574" />
+      <path
+         d="m 15.99,16.61 1.6,-0.92 v -1.84 l -1.6,0.92 z"
+         fill="#339999"
+         id="path1576" />
+      <path
+         d="M 9.59,12.92 6.4,14.77 v 1.84 l 3.19,-1.84 z"
+         fill="#76cede"
+         id="path1578" />
+      <path
+         d="M 9.59,12.92 6.4,14.77 4.8,13.85 8,12 Z"
+         fill="#d2edf3"
+         id="path1580" />
+      <path
+         d="M 11.19,10.15 V 6.46 L 9.59,5.54 v 3.69 z"
+         fill="#339999"
+         id="path1582" />
+      <path
+         d="M 11.19,10.15 V 6.46 l 1.6,-0.92 v 3.69 z m 1.6,2.77 3.2,1.85 v 1.84 l -3.2,-1.84 z"
+         fill="#76cede"
+         id="path1584" />
+      <path
+         d="m 12.79,12.92 3.2,1.85 1.6,-0.92 -3.2,-1.85 z"
+         fill="#d2edf3"
+         id="path1586" />
+      <path
+         d="M 11.19,23.07 12.79,24 V 22.15 M 3.2,5.54 1.6,4.62 v 1.84"
+         fill="#339999"
+         id="path1588" />
+      <path
+         d="M 11.19,23.07 9.59,24 v -1.85"
+         fill="#76cede"
+         id="path1590" />
+      <path
+         d="m 20.79,6.46 1.6,0.92 -1.6,0.92 M 1.6,8.3 0,7.38 1.6,6.46"
+         fill="#d2edf3"
+         id="path1592" />
+      <path
+         d="m 19.19,5.54 1.6,-0.92 v 1.84"
+         fill="#76cede"
+         id="path1594" />
+      <g
+         fill="#ffffff"
+         id="g1604">
+        <path
+           d="M 61.45,48.81 A 4.22,4.22 0 0 1 60.18,49 c -1.16,0 -1.5,-0.62 -1.5,-2.14 v -5.25 h 2.51 V 39.74 H 58.68 V 38.11 35 L 56,35.79 v 1.63 2.32 h -1.3 v 1.87 H 56 v 5.57 C 56,49.8 57.1,51 59.52,51 a 6.2,6.2 0 0 0 2.19,-0.34 z M 43.56,47.25 C 43.07,50.33 40.82,51 38.93,51 c -3.71,0 -5.17,-2.4 -5.17,-5.64 0,-3.62 2,-5.88 5.38,-5.88 3,0 4.55,1.87 4.55,5.08 0,0.36 0,0.82 -0.06,1.22 h -7.12 c 0,1.89 0.64,3.24 2.51,3.24 a 2.1,2.1 0 0 0 2.29,-2 z M 41.1,44 c 0.06,-1.72 -0.64,-2.7 -2.14,-2.7 -1.5,0 -2.36,1.27 -2.42,2.7 z M 71.58,35 V 51 H 70.26 V 49.16 A 3.77,3.77 0 0 1 66.88,51 c -2.64,0 -4.5,-1.54 -4.5,-5.55 0,-3.84 1.74,-5.92 4.65,-5.92 a 3.56,3.56 0 0 1 3.17,1.59 V 35 Z m -4.42,5.66 c -2.12,0 -3.32,1.57 -3.32,4.8 0,3.23 1.2,4.42 3.11,4.42 1.91,0 3.35,-1.16 3.35,-4.72 0,-3.56 -1.4,-4.5 -3.14,-4.5 z m 11.9,2.73 c 0.21,-2 -0.28,-2.42 -1.37,-2.42 -2,0 -2.72,1.87 -2.72,3.88 V 51 H 73.55 V 40 h 1.33 L 75,41.65 a 3.12,3.12 0 0 1 3,-1.87 c 1.69,0 2.77,1 2.38,3.54 z"
+           transform="translate(0,-31)"
+           id="path1596" />
+        <path
+           d="m 82.04,9.04 h 1.42 V 20 h -1.42 z m 0,-5.04 h 1.42 v 2.12 h -1.42 z"
+           id="path1598" />
+        <path
+           d="m 88.78,51 -3.9,-11 h 1.46 L 89.45,49.18 92.51,40 H 94 l -4,11 z m 14.3,-3.69 A 3.81,3.81 0 0 1 99,51 c -3.6,0 -4.74,-2.47 -4.74,-5.64 0,-3.47 1.67,-5.83 4.93,-5.83 2.9,0 4.33,2.19 3.92,6 H 95.7 c 0,2.3 0.75,4.29 3.28,4.29 a 2.7,2.7 0 0 0 2.94,-2.66 z m -1.22,-2.87 c 0.06,-2.14 -0.69,-3.77 -2.9,-3.77 -2.21,0 -3.22,1.87 -3.26,3.77 z M 113.33,51 h -1.42 v -6.37 c 0,-2.6 -0.86,-3.67 -2.66,-3.67 -2.55,0 -3.24,1.93 -3.24,3.73 V 51 H 104.6 V 40 h 1.33 l 0.09,1.67 a 3.63,3.63 0 0 1 3.41,-1.93 c 2.53,0 3.9,1.48 3.9,4.65 z M 51,43.09 a 1.76,1.76 0 0 0 -1.93,-1.76 c -1.09,0 -1.78,0.36 -1.78,1.22 0,2.4 6.18,0.39 6.18,4.85 0,2.34 -2.14,3.6 -4.63,3.6 -2.7,0 -4.25,-1.39 -4.62,-3.73 l 2.37,-0.19 a 2.13,2.13 0 0 0 2.29,2.07 c 1.35,0 2,-0.6 2,-1.39 0,-2.53 -6.11,-0.51 -6.11,-4.85 0,-2.25 1.93,-3.43 4.35,-3.43 2.42,0 3.84,1.07 4.23,3.11 z M 33.14,48.81 A 4.22,4.22 0 0 1 31.87,49 c -1.16,0 -1.5,-0.62 -1.5,-2.14 v -5.25 h 2.51 V 39.74 H 30.37 V 38.11 35 l -2.66,0.79 v 1.63 2.32 h -1.33 v 1.87 h 1.33 v 5.57 c 0,2.62 1.07,3.82 3.5,3.82 a 6.2,6.2 0 0 0 2.19,-0.34 z m 87.47,-3.43 c 0,-3.67 2.08,-5.6 4.88,-5.6 2.8,0 4.5,1.89 4.5,5.39 C 130,49 128.26,51 125.26,51 c -3.18,0 -4.65,-2 -4.65,-5.62 z m 8,-0.08 c 0,-2.47 -0.88,-4.36 -3.22,-4.36 -2.34,0 -3.32,2 -3.32,4.42 0,2.42 0.84,4.51 3.28,4.51 2.44,0 3.23,-2.04 3.23,-4.57 z"
+           transform="translate(0,-31)"
+           id="path1600" />
+        <path
+           d="m 114.88,17.88 h 1.42 V 20 h -1.42 z m 2.86,-8.84 h 1.42 V 20 h -1.42 z m 0,-5.04 h 1.42 v 2.12 h -1.42 z"
+           id="path1602" />
+      </g>
+    </g>
+    <text
+       xml:space="preserve"
+       style="font-size:4.23333px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;stroke-width:0.133861"
+       x="107.5555"
+       y="154.45795"
+       id="text1712"><tspan
+         sodipodi:role="line"
+         id="tspan1710"
+         x="107.5555"
+         y="154.45795"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333px;font-family:Roboto;-inkscape-font-specification:Roboto;text-align:center;text-anchor:middle;fill:#ffffff;stroke-width:0.133861">Learn Test-Driven Development </tspan><tspan
+         sodipodi:role="line"
+         x="107.5555"
+         y="159.79095"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333px;font-family:Roboto;-inkscape-font-specification:Roboto;text-align:center;text-anchor:middle;fill:#ffffff;stroke-width:0.133861"
+         id="tspan2004">with FastAPI</tspan></text>
+  </g>
+</svg>
index d0b73f9fc23711ccd166d1dd931e9da050106fa0..cef2d8e05182e24e2522bf30800e56b3a35d7421 100644 (file)
@@ -43,6 +43,20 @@ The key features are:
 
 <small>* estimation based on tests on an internal development team, building production applications.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## Opinions
 
 "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
index 6fa7dc6640a5cb0e69dc0a92e9b06eb8fe9bbe07..abd0d54bbc42a9edd6c256cdc571ad46c791e648 100644 (file)
@@ -123,7 +123,13 @@ nav:
   - advanced/openapi-callbacks.md
   - advanced/wsgi.md
 - async.md
-- deployment.md
+- Deployment:
+  - deployment/index.md
+  - deployment/versions.md
+  - deployment/https.md
+  - deployment/deta.md
+  - deployment/docker.md
+  - deployment/manually.md
 - project-generation.md
 - alternatives.md
 - history-design-future.md
index c1d714b287b9b4be09f9d42e8c33427619a4ad4f..6246a3527201d80e4e2dfd5fe718bbd4d447fd82 100644 (file)
@@ -261,7 +261,7 @@ Pero también puedes aprovechar los beneficios del paralelismo y el multiprocesa
 
 Eso, más el simple hecho de que Python es el lenguaje principal para **Data Science**, Machine Learning y especialmente Deep Learning, hacen de FastAPI una muy buena combinación para las API y aplicaciones web de Data Science / Machine Learning (entre muchas otras).
 
-Para ver cómo lograr este paralelismo en producción, consulta la sección sobre [Despliegue](deployment.md){.internal-link target=_blank}.
+Para ver cómo lograr este paralelismo en producción, consulta la sección sobre [Despliegue](deployment/index.md){.internal-link target=_blank}.
 
 ## `async` y `await`
 
index 30e5b1d92aba285a67ac4959d68b92df80c085f1..77053bdbd96ac906a9d8bce72361e628f4cebf82 100644 (file)
@@ -42,6 +42,20 @@ Sus características principales son:
 
 <small>* Esta estimación está basada en pruebas con un equipo de desarrollo interno contruyendo aplicaciones listas para producción.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Otros sponsors</a>
+
 ## Opiniones
 
 "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
index 5fb52cc3cb7ae19eb740e1cf88cebd2c84e94f38..7013e33c1fb0c70b15f1bf424e9834bb1c47dcc8 100644 (file)
@@ -47,6 +47,20 @@ The key features are:
 
 <small>* estimation based on tests on an internal development team, building production applications.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## Opinions
 
 "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
index 687cc7c2bfdb9510796e2e5f35054557f90563cf..16ba91418f0cb0964c51630aa5374221507864f7 100644 (file)
@@ -47,6 +47,20 @@ The key features are:
 
 <small>* estimation based on tests on an internal development team, building production applications.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## Opinions
 
 "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
index 57bf461187bf6164c089d3339194a6ff91d56002..27e3c8846dfeea67aa53c5ea57f549154e7b11e4 100644 (file)
@@ -408,7 +408,7 @@ Starletteや**FastAPI**のサーバーとして推奨されています。
 
     Gunicornと組み合わせることで、非同期でマルチプロセスなサーバーを持つことがきます。
 
-    詳細は[デプロイ](deployment.md){.internal-link target=_blank}の項目で確認してください。
+    詳細は[デプロイ](deployment/index.md){.internal-link target=_blank}の項目で確認してください。
 
 ## ベンチマーク と スピード
 
index 9fdce0ef2cf3ecdc39d87fabfb9507f5a8c913c2..72745e1ce4cb773e4a81a4a182e7289af852c55a 100644 (file)
@@ -43,6 +43,20 @@ FastAPI は、Pythonの標準である型ヒントに基づいてPython 3.6 以
 
 <small>\* 本番アプリケーションを構築している開発チームのテストによる見積もり。</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## 評価
 
 "_[...] 最近 **FastAPI** を使っています。 [...] 実際に私のチームの全ての **Microsoft の機械学習サービス** で使用する予定です。 そのうちのいくつかのコアな**Windows**製品と**Office**製品に統合されつつあります。_"
index 8db98885d37ef9d0a287f3fad451dd3573187ffe..3f03a337f848d09a512f53823d9d4f9790867d28 100644 (file)
@@ -47,6 +47,20 @@ The key features are:
 
 <small>* estimation based on tests on an internal development team, building production applications.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## Opinions
 
 "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
index 384eb08020d6c86225b7c3d92fa649661d8f24eb..1269fe66d84aceaabe8bdd84082f153b15401c26 100644 (file)
@@ -406,7 +406,7 @@ Ele é o servidor recomendado para Starlette e **FastAPI**.
 
     Você pode combinar ele com o Gunicorn, para ter um servidor multi-processos assíncrono.
 
-    Verifique mais detalhes na seção [Deployment](deployment.md){.internal-link target=_blank}.
+    Verifique mais detalhes na seção [Deployment](deployment/index.md){.internal-link target=_blank}.
 
 ## Performance e velocidade
 
index ed87d6897ab121b42b64d7432df21d3a2d9dc147..906b5244448b0b4cddf2970010199c202b93771a 100644 (file)
@@ -42,6 +42,20 @@ Os recursos chave são:
 
 <small>* estimativas baseadas em testes realizados com equipe interna de desenvolvimento, construindo aplicações em produção.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## Opiniões
 
 "*[...] Estou usando **FastAPI** muito esses dias. [...] Estou na verdade planejando utilizar ele em todos os times de **serviços _Machine Learning_ na Microsoft**. Alguns deles estão sendo integrados no _core_ do produto **Windows** e alguns produtos **Office**.*"
index 03abddc1d1785e842ed0ea7c4699c5d90744bb3a..086eb209c5e767aafa7abe14724f20b1b27f05e4 100644 (file)
@@ -47,6 +47,20 @@ The key features are:
 
 <small>* estimation based on tests on an internal development team, building production applications.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## Opinions
 
 "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
index 8db98885d37ef9d0a287f3fad451dd3573187ffe..3f03a337f848d09a512f53823d9d4f9790867d28 100644 (file)
@@ -47,6 +47,20 @@ The key features are:
 
 <small>* estimation based on tests on an internal development team, building production applications.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## Opinions
 
 "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
index d236da22c17ff6ef77b4e2844950dd71bed1bed8..671b3cf1040567034a2fcd43fb69439a4e870f25 100644 (file)
@@ -47,6 +47,20 @@ The key features are:
 
 <small>* estimation based on tests on an internal development team, building production applications.</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## Opinions
 
 "_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._"
index 93d9d98c49e864628ed1abe021944d0056e99af5..52a45eb0c1d1b9af7da60de58e21e7124431d541 100644 (file)
@@ -43,6 +43,20 @@ FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框
 
 <small>* 根据对某个构建线上应用的内部开发团队所进行的测试估算得出。</small>
 
+## Gold Sponsors
+
+<!-- sponsors -->
+
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+
+<!-- /sponsors -->
+
+<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">Other sponsors</a>
+
 ## 评价
 
 「_[...] 最近我一直在使用 **FastAPI**。[...] 实际上我正在计划将其用于我所在的**微软**团队的所有**机器学习服务**。其中一些服务正被集成进核心 **Windows** 产品和一些 **Office** 产品。_」
index 284f344f68026725ca7d0f9b7caa245733b53639..e11bacb64698f368ac819716bced831855f932c3 100644 (file)
@@ -1,4 +1,5 @@
 import os
+import re
 import shutil
 from http.server import HTTPServer, SimpleHTTPRequestHandler
 from multiprocessing import Pool
@@ -11,6 +12,7 @@ import mkdocs.config
 import mkdocs.utils
 import typer
 import yaml
+from jinja2 import Template
 
 app = typer.Typer()
 
@@ -194,6 +196,62 @@ def build_lang(
     typer.secho(f"Successfully built docs for: {lang}", color=typer.colors.GREEN)
 
 
+index_sponsors_template = """
+{% if sponsors %}
+{% for sponsor in sponsors.gold -%}
+<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
+{% endfor %}
+{% endif %}
+"""
+
+
+def generate_readme_content():
+    en_index = en_docs_path / "docs" / "index.md"
+    content = en_index.read_text("utf-8")
+    match_start = re.search(r"<!-- sponsors -->", content)
+    match_end = re.search(r"<!-- /sponsors -->", content)
+    sponsors_data_path = en_docs_path / "data" / "sponsors.yml"
+    sponsors = mkdocs.utils.yaml_load(sponsors_data_path.read_text(encoding="utf-8"))
+    if not (match_start and match_end):
+        raise RuntimeError("Couldn't auto-generate sponsors section")
+    pre_end = match_start.end()
+    post_start = match_end.start()
+    template = Template(index_sponsors_template)
+    message = template.render(sponsors=sponsors)
+    pre_content = content[:pre_end]
+    post_content = content[post_start:]
+    new_content = pre_content + message + post_content
+    return new_content
+
+
+@app.command()
+def generate_readme():
+    """
+    Generate README.md content from main index.md
+    """
+    typer.echo("Generating README")
+    readme_path = Path("README.md")
+    new_content = generate_readme_content()
+    readme_path.write_text(new_content, encoding="utf-8")
+
+
+@app.command()
+def verify_readme():
+    """
+    Verify README.md content from main index.md
+    """
+    typer.echo("Verifying README")
+    readme_path = Path("README.md")
+    generated_content = generate_readme_content()
+    readme_content = readme_path.read_text("utf-8")
+    if generated_content != readme_content:
+        typer.secho(
+            "README.md outdated from the latest index.md", color=typer.colors.RED
+        )
+        raise typer.Abort()
+    typer.echo("Valid README ✅")
+
+
 @app.command()
 def build_all():
     """
@@ -202,24 +260,19 @@ def build_all():
     """
     site_path = Path("site").absolute()
     update_languages(lang=None)
-    en_build_path: Path = docs_path / "en"
     current_dir = os.getcwd()
-    os.chdir(en_build_path)
-    typer.echo(f"Building docs for: en")
+    os.chdir(en_docs_path)
+    typer.echo("Building docs for: en")
     mkdocs.commands.build.build(mkdocs.config.load_config(site_dir=str(site_path)))
     os.chdir(current_dir)
-
     langs = []
     for lang in get_lang_paths():
-        if lang == en_build_path or not lang.is_dir():
+        if lang == en_docs_path or not lang.is_dir():
             continue
         langs.append(lang.name)
     cpu_count = os.cpu_count() or 1
     with Pool(cpu_count * 2) as p:
         p.map(build_lang, langs)
-    typer.echo("Copying en index.md to README.md")
-    en_index = en_build_path / "docs" / "index.md"
-    shutil.copyfile(en_index, "README.md")
 
 
 def update_single_lang(lang: str):
index e43f179ce14db6181bbac0d2a1987ecd29d36d11..b593133d8293f4f639e54d148e5e6f1bac3b7d4b 100755 (executable)
@@ -5,6 +5,6 @@ set -x
 
 bash ./scripts/lint.sh
 # Check README.md is up to date
-diff --brief docs/en/docs/index.md README.md
+python ./scripts/docs.py verify-readme
 export PYTHONPATH=./docs_src
 pytest --cov=fastapi --cov=tests --cov=docs/src --cov-report=term-missing --cov-report=xml tests ${@}