From 3040ad9d40c9a26ef06559e993fe875ad151aeb8 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Thu, 12 Aug 2021 13:05:41 +0200 Subject: [PATCH 1/4] docs(fr): add page --- docs/fr/docs/deployment/deta.md | 240 ++++++++++++++++++++++++++++++++ docs/fr/mkdocs.yml | 2 + 2 files changed, 242 insertions(+) create mode 100644 docs/fr/docs/deployment/deta.md diff --git a/docs/fr/docs/deployment/deta.md b/docs/fr/docs/deployment/deta.md new file mode 100644 index 0000000000000..fd4b30a3cffdd --- /dev/null +++ b/docs/fr/docs/deployment/deta.md @@ -0,0 +1,240 @@ +# Deploy FastAPI on Deta + +In this section you will learn how to easily deploy a **FastAPI** application on Deta using the free plan. 🎁 + +It will take you about **10 minutes**. + +!!! info + Deta 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 free account on Deta, 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 CLI: + +=== "Linux, macOS" + +
+ + ```console + $ curl -fsSL https://get.deta.dev/cli.sh | sh + ``` + +
+ +=== "Windows PowerShell" + +
+ + ```console + $ iwr https://get.deta.dev/cli.ps1 -useb | iex + ``` + +
+ +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: + +
+ +```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 + +... +``` + +
+ +!!! tip + If you have problems installing the CLI, check the official Deta docs. + +## Login with the CLI + +Now login to Deta from the CLI with: + +
+ +```console +$ deta login + +Please, log in from the web page. Waiting.. +Logged in successfully. +``` + +
+ +This will open a web browser and authenticate automatically. + +## Deploy with Deta + +Next, deploy your application with the Deta CLI: + +
+ +```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 +``` + +
+ +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: + + + +## 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: + +
+ +```console +$ deta auth disable + +Successfully disabled http auth +``` + +
+ +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 https://web.deta.sh. + +You will see there's a section to the left called "Micros" 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. + + + +## 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 Deta Base, it also has a generous **free tier**. + +You can also read more in the Deta Docs. diff --git a/docs/fr/mkdocs.yml b/docs/fr/mkdocs.yml index 6511f64d5e553..beb91b43e07aa 100644 --- a/docs/fr/mkdocs.yml +++ b/docs/fr/mkdocs.yml @@ -58,6 +58,8 @@ nav: - python-types.md - Tutoriel - Guide utilisateur: - tutorial/background-tasks.md +- Deploiement: + - deployment/deta.md - project-generation.md - alternatives.md - external-links.md From 534c76bdf4f79a8fe2728df5909d370f62b435ba Mon Sep 17 00:00:00 2001 From: Ruidy Date: Thu, 12 Aug 2021 13:34:56 +0200 Subject: [PATCH 2/4] docs(fr): add translation --- docs/fr/docs/deployment/deta.md | 105 +++++++++++++++++--------------- 1 file changed, 55 insertions(+), 50 deletions(-) diff --git a/docs/fr/docs/deployment/deta.md b/docs/fr/docs/deployment/deta.md index fd4b30a3cffdd..d19f35776428a 100644 --- a/docs/fr/docs/deployment/deta.md +++ b/docs/fr/docs/deployment/deta.md @@ -1,19 +1,20 @@ -# Deploy FastAPI on Deta +# DĂ©ployer FastAPI sur Deta -In this section you will learn how to easily deploy a **FastAPI** application on Deta using the free plan. 🎁 +Dans cette section, vous apprendrez Ă  dĂ©ployer facilement une application **FastAPI** sur Deta en utilisant le plan tarifaire gratuit. 🎁 -It will take you about **10 minutes**. +Cela vous prendra environ **10 minutes**. !!! info - Deta is a **FastAPI** sponsor. 🎉 + Deta sponsorise **FastAPI**. 🎉 -## A basic **FastAPI** app +## Une application **FastAPI** de base -* Create a directory for your app, for example `./fastapideta/` and enter in it. +* CrĂ©ez un rĂ©pertoire pour votre application, par exemple `./fastapideta/` et dĂ©placez-vous dedans. -### FastAPI code +### Le code FastAPI -* Create a `main.py` file with: +* CrĂ©er un fichier `main.py` avec : ```Python from fastapi import FastAPI @@ -31,20 +32,20 @@ def read_item(item_id: int): return {"item_id": item_id} ``` -### Requirements +### DĂ©pendances -Now, in the same directory create a file `requirements.txt` with: +Maintenant, dans le mĂȘme rĂ©pertoire, crĂ©ez un fichier `requirements.txt` avec : ```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. + Il n'est pas nĂ©cessaire d'installer Uvicorn pour dĂ©ployer sur Deta, bien qu'il soit probablement souhaitable de l'installer localement pour tester votre application. -### Directory structure +### Structure du rĂ©pertoire -You will now have one directory `./fastapideta/` with two files: +Vous aurez maintenant un rĂ©pertoire `./fastapideta/` avec deux fichiers : ``` . @@ -52,15 +53,16 @@ You will now have one directory `./fastapideta/` with two files: └── requirements.txt ``` -## Create a free Deta account +## CrĂ©er un compte gratuit sur Deta -Now create a free account on Deta, you just need an email and password. +CrĂ©ez maintenant un compte gratuit +sur Deta, vous avez juste besoin d'une adresse email et d'un mot de passe. -You don't even need a credit card. +Vous n'avez mĂȘme pas besoin d'une carte de crĂ©dit. -## Install the CLI +## Installer le CLI (Interface en Ligne de Commande) -Once you have your account, install the Deta CLI: +Une fois que vous avez votre compte, installez le CLI de Deta : === "Linux, macOS" @@ -82,9 +84,9 @@ Once you have your account, install the Deta @@ -107,11 +109,11 @@ Available Commands: !!! tip - If you have problems installing the CLI, check the official Deta docs. + Si vous rencontrez des problĂšmes pour installer le CLI, consultez la documentation officielle de Deta (en anglais). -## Login with the CLI +## Connexion avec le CLI -Now login to Deta from the CLI with: +Maintenant, connectez-vous Ă  Deta depuis le CLI avec :
@@ -124,11 +126,11 @@ Logged in successfully.
-This will open a web browser and authenticate automatically. +Cela ouvrira un navigateur web et permettra une authentification automatique. -## Deploy with Deta +## Déployer avec Deta -Next, deploy your application with the Deta CLI: +Ensuite, déployez votre application avec le CLI de Deta :
@@ -158,7 +160,7 @@ Successfully installed fastapi-0.61.1 pydantic-1.7.2 starlette-0.13.6
-You will see a JSON message similar to: +Vous verrez un message JSON similaire à : ```JSON hl_lines="4" { @@ -171,13 +173,14 @@ You will see a JSON message similar to: ``` !!! tip - Your deployment will have a different `"endpoint"` URL. + Votre dĂ©ploiement aura une URL `"endpoint"` diffĂ©rente. -## Check it +## VĂ©rifiez -Now open your browser in your `endpoint` URL. In the example above it was `https://qltnci.deta.dev`, but yours will be different. +Maintenant, dans votre navigateur ouvrez votre URL `endpoint`. Dans l'exemple ci-dessus, c'Ă©tait +`https://qltnci.deta.dev`, mais la vĂŽtre sera diffĂ©rente. -You will see the JSON response from your FastAPI app: +Vous verrez la rĂ©ponse JSON de votre application FastAPI : ```JSON { @@ -185,17 +188,17 @@ You will see the JSON response from your FastAPI app: } ``` -And now go to the `/docs` for your API, in the example above it would be `https://qltnci.deta.dev/docs`. +Et maintenant naviguez vers `/docs` dans votre API, dans l'exemple ci-dessus ce serait `https://qltnci.deta.dev/docs`. -It will show your docs like: +Vous verrez votre documentation comme suit : -## Enable public access +## Activer l'accĂšs public -By default, Deta will handle authentication using cookies for your account. +Par dĂ©faut, Deta va gĂ©rer l'authentification en utilisant des cookies pour votre compte. -But once you are ready, you can make it public with: +Mais une fois que vous ĂȘtes prĂȘt, vous pouvez le rendre public avec :
@@ -207,34 +210,36 @@ Successfully disabled http auth
-Now you can share that URL with anyone and they will be able to access your API. 🚀 +Maintenant, vous pouvez partager cette URL avec n'importe qui et ils seront en mesure d'accĂ©der Ă  votre API. 🚀 ## HTTPS -Congrats! You deployed your FastAPI app to Deta! 🎉 🍰 +FĂ©licitations ! Vous avez dĂ©ployĂ© votre application FastAPI sur 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. ✅ 🔒 +Remarquez Ă©galement que Deta gĂšre correctement HTTPS pour vous, vous n'avez donc pas Ă  vous en occuper et pouvez ĂȘtre sĂ»r que vos clients auront une connexion cryptĂ©e sĂ©curisĂ©e. ✅ 🔒 -## Check the Visor +## VĂ©rifiez le 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}`. +À partir de l'interface graphique de votre documentation (dans une URL telle que `https://qltnci.deta.dev/docs`) +envoyez une requĂȘte Ă  votre *opĂ©ration de chemin* `/items/{item_id}`. -For example with ID `5`. +Par exemple avec l'ID `5`. -Now go to https://web.deta.sh. +Allez maintenant sur https://web.deta.sh. -You will see there's a section to the left called "Micros" with each of your apps. +Vous verrez qu'il y a une section Ă  gauche appelĂ©e "Micros" avec chacune de vos applications. -You will see a tab with "Details", and also a tab "Visor", go to the tab "Visor". +Vous verrez un onglet avec "Details", et aussi un onglet "Visor", allez Ă  l'onglet "Visor". -In there you can inspect the recent requests sent to your app. +Vous pouvez y consulter les requĂȘtes rĂ©centes envoyĂ©es Ă  votre application. -You can also edit them and re-play them. +Vous pouvez Ă©galement les modifier et les rĂ©Ă©couter. -## Learn more +## En savoir plus -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 Deta Base, it also has a generous **free tier**. +À un moment donnĂ©, vous voudrez probablement stocker certaines donnĂ©es pour votre application d'une maniĂšre qui +persiste dans le temps. Pour cela, vous pouvez utiliser Deta Base, il dispose Ă©galement d'un gĂ©nĂ©reux **plan gratuit**. -You can also read more in the Deta Docs. +Vous pouvez Ă©galement en lire plus dans la documentation Deta. From 76274c2ad56b801ea5243015d85aa8a4e9856dfd Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sun, 12 Sep 2021 21:53:33 +0200 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Sam Courtemanche --- docs/fr/docs/deployment/deta.md | 8 ++++---- docs/fr/mkdocs.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/fr/docs/deployment/deta.md b/docs/fr/docs/deployment/deta.md index d19f35776428a..51c9437cdde56 100644 --- a/docs/fr/docs/deployment/deta.md +++ b/docs/fr/docs/deployment/deta.md @@ -40,7 +40,7 @@ Maintenant, dans le mĂȘme rĂ©pertoire, crĂ©ez un fichier `requirements.txt` avec fastapi ``` -!!! tip +!!! tip "Astuce" Il n'est pas nĂ©cessaire d'installer Uvicorn pour dĂ©ployer sur Deta, bien qu'il soit probablement souhaitable de l'installer localement pour tester votre application. ### Structure du rĂ©pertoire @@ -108,7 +108,7 @@ Available Commands: -!!! tip +!!! tip "Astuce" Si vous rencontrez des problĂšmes pour installer le CLI, consultez la documentation officielle de Deta (en anglais). ## Connexion avec le CLI @@ -172,7 +172,7 @@ Vous verrez un message JSON similaire à : } ``` -!!! tip +!!! tip "Astuce" Votre dĂ©ploiement aura une URL `"endpoint"` diffĂ©rente. ## VĂ©rifiez @@ -233,7 +233,7 @@ Vous verrez un onglet avec "Details", et aussi un onglet "Visor", allez Ă  l'ong Vous pouvez y consulter les requĂȘtes rĂ©centes envoyĂ©es Ă  votre application. -Vous pouvez Ă©galement les modifier et les rĂ©Ă©couter. +Vous pouvez Ă©galement les modifier et les relancer. diff --git a/docs/fr/mkdocs.yml b/docs/fr/mkdocs.yml index 1c5a7dca3ee6f..3d6f66a8bdc7e 100644 --- a/docs/fr/mkdocs.yml +++ b/docs/fr/mkdocs.yml @@ -60,7 +60,7 @@ nav: - Tutoriel - Guide utilisateur: - tutorial/background-tasks.md - async.md -- Deploiement: +- DĂ©ploiement: - deployment/deta.md - project-generation.md - alternatives.md From f3120f05f7d5e9d59f2aa0a9b33d9f26fd67ec02 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 17:53:06 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20for?= =?UTF-8?q?mat=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/fr/docs/deployment/deta.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/fr/docs/deployment/deta.md b/docs/fr/docs/deployment/deta.md index 51c9437cdde56..cceb7b058c58b 100644 --- a/docs/fr/docs/deployment/deta.md +++ b/docs/fr/docs/deployment/deta.md @@ -53,9 +53,9 @@ Vous aurez maintenant un rĂ©pertoire `./fastapideta/` avec deux fichiers : └── requirements.txt ``` -## CrĂ©er un compte gratuit sur Deta +## CrĂ©er un compte gratuit sur Deta -CrĂ©ez maintenant un compte gratuit +CrĂ©ez maintenant un compte gratuit sur Deta, vous avez juste besoin d'une adresse email et d'un mot de passe. Vous n'avez mĂȘme pas besoin d'une carte de crĂ©dit. @@ -177,7 +177,7 @@ Vous verrez un message JSON similaire à : ## VĂ©rifiez -Maintenant, dans votre navigateur ouvrez votre URL `endpoint`. Dans l'exemple ci-dessus, c'Ă©tait +Maintenant, dans votre navigateur ouvrez votre URL `endpoint`. Dans l'exemple ci-dessus, c'Ă©tait `https://qltnci.deta.dev`, mais la vĂŽtre sera diffĂ©rente. Vous verrez la rĂ©ponse JSON de votre application FastAPI : @@ -220,7 +220,7 @@ Remarquez Ă©galement que Deta gĂšre correctement HTTPS pour vous, vous n'avez do ## VĂ©rifiez le Visor -À partir de l'interface graphique de votre documentation (dans une URL telle que `https://qltnci.deta.dev/docs`) +À partir de l'interface graphique de votre documentation (dans une URL telle que `https://qltnci.deta.dev/docs`) envoyez une requĂȘte Ă  votre *opĂ©ration de chemin* `/items/{item_id}`. Par exemple avec l'ID `5`. @@ -239,7 +239,7 @@ Vous pouvez Ă©galement les modifier et les relancer. ## En savoir plus -À un moment donnĂ©, vous voudrez probablement stocker certaines donnĂ©es pour votre application d'une maniĂšre qui +À un moment donnĂ©, vous voudrez probablement stocker certaines donnĂ©es pour votre application d'une maniĂšre qui persiste dans le temps. Pour cela, vous pouvez utiliser Deta Base, il dispose Ă©galement d'un gĂ©nĂ©reux **plan gratuit**. Vous pouvez Ă©galement en lire plus dans la documentation Deta.