Pamela Fox commited on
Commit
f28be2b
·
1 Parent(s): 80db45a

More azd fixes

Browse files
.devcontainer/devcontainer.json CHANGED
@@ -49,7 +49,7 @@
49
  },
50
 
51
  // Use 'postCreateCommand' to run commands after the container is created.
52
- "postCreateCommand": "pip install -r requirements.txt",
53
 
54
  // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
55
  "remoteUser": "vscode",
 
49
  },
50
 
51
  // Use 'postCreateCommand' to run commands after the container is created.
52
+ "postCreateCommand": "pip install -r requirements-dev.txt && pre-commit install",
53
 
54
  // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
55
  "remoteUser": "vscode",
.gitignore CHANGED
@@ -2,3 +2,5 @@
2
  __pycache__/
3
  staticfiles/
4
  .coverage
 
 
 
2
  __pycache__/
3
  staticfiles/
4
  .coverage
5
+
6
+ .azure
README.md CHANGED
@@ -46,13 +46,18 @@ coverage report
46
 
47
  ## Deployment
48
 
49
- The app is currently hosted on Microsoft Azure. Specifically:
50
 
51
- * Azure App Service
52
- * Azure Database for PostGreSQL flexible server
 
53
 
54
- To deploy your own instance, follow the [tutorial for Django app + PostGreSQL deployment](https://docs.microsoft.com/en-us/azure/app-service/tutorial-python-postgresql-app?tabs=django%2Cwindows%2Cvscode-aztools%2Cterminal-bash%2Cazure-portal-access%2Cvscode-aztools-deploy%2Cdeploy-instructions-azportal%2Cdeploy-instructions--zip-azcli%2Cdeploy-instructions-curl-bash) but using this app instead of the sample app.
 
 
55
 
56
- Make sure you specify the following environment variables in the App Service configuration: `SECRET_KEY`, `DBHOST`, `DBNAME`, `DBPASS`, `DBUSER`. The previously linked tutorial shows how to set these.
57
 
58
- TODO: az commands
 
 
 
46
 
47
  ## Deployment
48
 
49
+ This repository is set up for deployment on Azure App Service (w/PostGreSQL flexible server) using the configuration files in the `infra` folder.
50
 
51
+ 1. Sign up for a [free Azure account](https://azure.microsoft.com/free/?WT.mc_id=python-79461-pamelafox)
52
+ 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.)
53
+ 3. Provision and deploy all the resources:
54
 
55
+ ```
56
+ azd up
57
+ ```
58
 
59
+ 4. To be able to access `/admin`, you'll need a Django superuser. Navigate to the Azure Portal for the App Service, select SSH, and run this command:
60
 
61
+ ```
62
+ python manage.py createsuperuser
63
+ ```
infra/resources.bicep CHANGED
@@ -92,6 +92,7 @@ resource web 'Microsoft.Web/sites@2022-03-01' = {
92
  alwaysOn: true
93
  linuxFxVersion: 'PYTHON|3.10'
94
  ftpsState: 'Disabled'
 
95
  }
96
  httpsOnly: true
97
  }
 
92
  alwaysOn: true
93
  linuxFxVersion: 'PYTHON|3.10'
94
  ftpsState: 'Disabled'
95
+ appCommandLine: 'python manage.py migrate'
96
  }
97
  httpsOnly: true
98
  }