Pamela Fox
commited on
Commit
·
5f87718
1
Parent(s):
ee0267e
Update URLs
Browse files- infra/main.bicep +1 -0
- quizsite/production.py +1 -0
- quizsite/settings.py +2 -0
- quizsite/urls.py +2 -1
infra/main.bicep
CHANGED
@@ -76,6 +76,7 @@ module web 'core/host/appservice.bicep' = {
|
|
76 |
managedIdentity: true
|
77 |
appCommandLine: 'python manage.py migrate && gunicorn --workers 2 --threads 4 --timeout 60 --access-logfile \'-\' --error-logfile \'-\' --bind=0.0.0.0:8000 --chdir=/home/site/wwwroot quizsite.wsgi'
|
78 |
appSettings: {
|
|
|
79 |
DBHOST: postgresServerName
|
80 |
DBNAME: postgresDatabaseName
|
81 |
DBUSER: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=postgresAdminUser)'
|
|
|
76 |
managedIdentity: true
|
77 |
appCommandLine: 'python manage.py migrate && gunicorn --workers 2 --threads 4 --timeout 60 --access-logfile \'-\' --error-logfile \'-\' --bind=0.0.0.0:8000 --chdir=/home/site/wwwroot quizsite.wsgi'
|
78 |
appSettings: {
|
79 |
+
ADMIN_URL: 'admin${uniqueString(appServicePlan.outputs.id)}'
|
80 |
DBHOST: postgresServerName
|
81 |
DBNAME: postgresDatabaseName
|
82 |
DBUSER: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=postgresAdminUser)'
|
quizsite/production.py
CHANGED
@@ -6,6 +6,7 @@ import os
|
|
6 |
ALLOWED_HOSTS = [os.environ["WEBSITE_HOSTNAME"]] if "WEBSITE_HOSTNAME" in os.environ else []
|
7 |
CSRF_TRUSTED_ORIGINS = ["https://" + os.environ["WEBSITE_HOSTNAME"]] if "WEBSITE_HOSTNAME" in os.environ else []
|
8 |
DEBUG = False
|
|
|
9 |
|
10 |
# DBHOST is only the server name, not the full URL
|
11 |
hostname = os.environ["DBHOST"]
|
|
|
6 |
ALLOWED_HOSTS = [os.environ["WEBSITE_HOSTNAME"]] if "WEBSITE_HOSTNAME" in os.environ else []
|
7 |
CSRF_TRUSTED_ORIGINS = ["https://" + os.environ["WEBSITE_HOSTNAME"]] if "WEBSITE_HOSTNAME" in os.environ else []
|
8 |
DEBUG = False
|
9 |
+
ADMIN_URL = os.environ["ADMIN_URL"]
|
10 |
|
11 |
# DBHOST is only the server name, not the full URL
|
12 |
hostname = os.environ["DBHOST"]
|
quizsite/settings.py
CHANGED
@@ -26,6 +26,8 @@ SECRET_KEY = os.getenv("SECRET_KEY")
|
|
26 |
# SECURITY WARNING: don't run with debug turned on in production!
|
27 |
DEBUG = True
|
28 |
|
|
|
|
|
29 |
CSRF_TRUSTED_ORIGINS = [
|
30 |
"http://localhost:8000",
|
31 |
f"https://{os.getenv('CODESPACE_NAME')}-8000.{os.getenv('GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN')}",
|
|
|
26 |
# SECURITY WARNING: don't run with debug turned on in production!
|
27 |
DEBUG = True
|
28 |
|
29 |
+
ADMIN_URL = "admin/"
|
30 |
+
|
31 |
CSRF_TRUSTED_ORIGINS = [
|
32 |
"http://localhost:8000",
|
33 |
f"https://{os.getenv('CODESPACE_NAME')}-8000.{os.getenv('GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN')}",
|
quizsite/urls.py
CHANGED
@@ -13,10 +13,11 @@ Including another URLconf
|
|
13 |
1. Import the include() function: from django.urls import include, path
|
14 |
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
15 |
"""
|
|
|
16 |
from django.contrib import admin
|
17 |
from django.urls import include, path
|
18 |
|
19 |
urlpatterns = [
|
20 |
path("", include("quizzes.urls")),
|
21 |
-
path(
|
22 |
]
|
|
|
13 |
1. Import the include() function: from django.urls import include, path
|
14 |
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
15 |
"""
|
16 |
+
from django.conf import settings
|
17 |
from django.contrib import admin
|
18 |
from django.urls import include, path
|
19 |
|
20 |
urlpatterns = [
|
21 |
path("", include("quizzes.urls")),
|
22 |
+
path(settings.ADMIN_URL, admin.site.urls),
|
23 |
]
|