Pamela Fox
commited on
Commit
·
4114b0e
1
Parent(s):
74f4314
Add readme
Browse files
README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Quizzes app
|
| 2 |
+
|
| 3 |
+
An example Django app that serves quizzes and lets people know how they scored.
|
| 4 |
+
Quizzes and their questions are stored in a PostGreSQL database.
|
| 5 |
+
There is no user authentication or per-user data stored.
|
| 6 |
+
|
| 7 |
+
Try it out at:
|
| 8 |
+
|
| 9 |
+
```
|
| 10 |
+
https://django-example-quizsite.azurewebsites.net/quizzes/
|
| 11 |
+
```
|
| 12 |
+
|
| 13 |
+
## Local development
|
| 14 |
+
|
| 15 |
+
Install the requirements:
|
| 16 |
+
|
| 17 |
+
```
|
| 18 |
+
pip install -r requirements.txt
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
Create a local PostGreSQL database called "quizsite"
|
| 22 |
+
and update `.env` with the relevant database details.
|
| 23 |
+
|
| 24 |
+
Run the migrations:
|
| 25 |
+
|
| 26 |
+
```
|
| 27 |
+
python manage.py migrate
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
Run the local server:
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
python manage.py runserver
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
## Deployment
|
| 37 |
+
|
| 38 |
+
The app is currently hosted on Microsoft Azure. Specifically:
|
| 39 |
+
|
| 40 |
+
* Azure App Service
|
| 41 |
+
* Azure Database for PostGreSQL flexible server
|
| 42 |
+
|
| 43 |
+
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.
|
| 44 |
+
|
| 45 |
+
Make sure you specify the following environment variables in the App Service configuration: `DBHOST`, `DBNAME`, `DBPASS`, `DBUSER`. The previously linked tutorial shows how to set these.
|