You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-6Lines changed: 30 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,12 +52,36 @@ The app is currently hosted on Microsoft Azure. Specifically:
52
52
* Azure Database for PostGreSQL flexible server
53
53
* Azure Cognitive Services (for Translation)
54
54
55
-
To deploy your own instance, follow the [tutorial for Flask app + PostGreSQL deployment](https://docs.microsoft.com/en-us/azure/app-service/tutorial-python-postgresql-app) but using this app instead of the sample app.
55
+
To deploy your own instance, follow these steps:
56
56
57
-
Make sure you specify the following environment variables in the App Service configuration:
57
+
1. Sign up for a [free Azure account](https://azure.microsoft.com/free/?WT.mc_id=python-79461-pamelafox)
58
+
2. Install the [Azure Dev CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd?WT.mc_id=python-79461-pamelafox). (If you open this repository in Codespaces or with the VS Code Dev Containers extension, that part will be done for you.)
59
+
3. Initialize a new `azd` environment:
58
60
59
-
*`DBHOST`, `DBNAME`, `DBPASS`, `DBUSER`: The above linked tutorial shows how to set these.
60
-
*`FLASK_APP`: Set to 'src'
61
-
*`AZURE_TRANSLATE_API_KEY`: Get this by registering for Azure Cognitive Services.
61
+
```shell
62
+
azd init
63
+
```
62
64
63
-
You will also need to migrate the database by using the App Service SSH and running `flask db upgrade`.
65
+
It will prompt you to provide a name (like "flask-app") that will later be used in the name of the deployed resources.
66
+
67
+
4. Provision and deploy all the resources:
68
+
69
+
```shell
70
+
azd up
71
+
```
72
+
73
+
It will prompt you to login, pick a subscription, and provide a location (like "eastus"). Then it will provision the resources in your account and deploy the latest code. If you get an error with deployment, changing the location (like to "centralus") can help, as there may be availability constraints for some of the resources.
74
+
75
+
5. When azd has finished deploying, you'll see an endpoint URI in the command output. Visit that URI and you should see the website and be able to translate messages.
76
+
77
+
6. For the website to work fully (i.e. save translations to the database), you must migrate the database. Navigate to the App Service in the Azure Portal, select SSH, and run this command once you're in the SSH terminal:
78
+
79
+
```shell
80
+
flask db upgrade
81
+
```
82
+
83
+
6. When you've made any changes to the app code, you can just run:
@description('The name of the Cognitive Service.')
2
+
paramnamestring
3
+
4
+
@description('The location into which your Azure resources should be deployed.')
5
+
paramlocationstring = resourceGroup().location
6
+
7
+
@description('The tags to apply to each resource.')
8
+
paramtagsobject = {}
9
+
10
+
@description('The kind of Cognitive Service to create. See: https://learn.microsoft.com/en-us/azure/cognitive-services/create-account-bicep for available kinds.')
@description('The name of the SKU. Be aware that not all SKUs may be available for your Subscription. See: https://learn.microsoft.com/en-us/rest/api/cognitiveservices/accountmanagement/resource-skus')
0 commit comments