Pamela Fox
commited on
Commit
·
886a656
1
Parent(s):
b4cc641
Changes for test explorer
Browse files- .devcontainer/devcontainer.json +0 -2
- .env.sample +3 -0
- .env.test +2 -0
- .vscode/settings.json +0 -11
- infra/main.bicep +2 -1
- pyproject.toml +2 -1
- requirements-dev.txt +1 -0
- src/quizsite/settings.py +5 -1
.devcontainer/devcontainer.json
CHANGED
|
@@ -1,5 +1,3 @@
|
|
| 1 |
-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
| 2 |
-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
|
| 3 |
{
|
| 4 |
"name": "django-quiz-app",
|
| 5 |
"dockerComposeFile": "docker-compose.yml",
|
|
|
|
|
|
|
|
|
|
| 1 |
{
|
| 2 |
"name": "django-quiz-app",
|
| 3 |
"dockerComposeFile": "docker-compose.yml",
|
.env.sample
CHANGED
|
@@ -2,4 +2,7 @@ DBHOST=localhost
|
|
| 2 |
DBNAME=app
|
| 3 |
DBUSER=app_user
|
| 4 |
DBPASS=app_password
|
|
|
|
| 5 |
SECRET_KEY=InsecureKeyNotForProduction
|
|
|
|
|
|
|
|
|
| 2 |
DBNAME=app
|
| 3 |
DBUSER=app_user
|
| 4 |
DBPASS=app_password
|
| 5 |
+
DEBUG=True
|
| 6 |
SECRET_KEY=InsecureKeyNotForProduction
|
| 7 |
+
STATIC_BACKEND=whitenoise.storage.CompressedManifestStaticFilesStorage
|
| 8 |
+
DJANGO_SETTINGS_MODULE=quizsite.settings
|
.env.test
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is checked in, so it should NOT contains keys or secrets
|
| 2 |
+
STATIC_BACKEND=django.contrib.staticfiles.storage.StaticFilesStorage
|
.vscode/settings.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"python.testing.unittestArgs": [
|
| 3 |
-
"-v",
|
| 4 |
-
"-s",
|
| 5 |
-
"./src",
|
| 6 |
-
"-p",
|
| 7 |
-
"test*.py"
|
| 8 |
-
],
|
| 9 |
-
"python.testing.pytestEnabled": false,
|
| 10 |
-
"python.testing.unittestEnabled": true
|
| 11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
infra/main.bicep
CHANGED
|
@@ -79,6 +79,7 @@ module web 'core/host/appservice.bicep' = {
|
|
| 79 |
DBUSER: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=postgresAdminUser)'
|
| 80 |
DBPASS: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=postgresAdminPassword)'
|
| 81 |
DBSSL: 'require'
|
|
|
|
| 82 |
SECRET_KEY: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=djangoSecretKey)'
|
| 83 |
}
|
| 84 |
}
|
|
@@ -157,4 +158,4 @@ module logAnalyticsWorkspace 'core/monitor/loganalytics.bicep' = {
|
|
| 157 |
|
| 158 |
output WEB_URI string = 'https://${web.outputs.uri}'
|
| 159 |
output AZURE_LOCATION string = location
|
| 160 |
-
output AZURE_KEY_VAULT_NAME string = keyVault.outputs.name
|
|
|
|
| 79 |
DBUSER: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=postgresAdminUser)'
|
| 80 |
DBPASS: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=postgresAdminPassword)'
|
| 81 |
DBSSL: 'require'
|
| 82 |
+
STATIC_BACKEND: 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
| 83 |
SECRET_KEY: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=djangoSecretKey)'
|
| 84 |
}
|
| 85 |
}
|
|
|
|
| 158 |
|
| 159 |
output WEB_URI string = 'https://${web.outputs.uri}'
|
| 160 |
output AZURE_LOCATION string = location
|
| 161 |
+
output AZURE_KEY_VAULT_NAME string = keyVault.outputs.name
|
pyproject.toml
CHANGED
|
@@ -17,4 +17,5 @@ exclude = '''
|
|
| 17 |
addopts = "-ra --cov=src --cov-report=term-missing:skip-covered --junitxml=pytest.xml"
|
| 18 |
pythonpath = ["src"]
|
| 19 |
python_files = ["tests.py"]
|
| 20 |
-
|
|
|
|
|
|
| 17 |
addopts = "-ra --cov=src --cov-report=term-missing:skip-covered --junitxml=pytest.xml"
|
| 18 |
pythonpath = ["src"]
|
| 19 |
python_files = ["tests.py"]
|
| 20 |
+
env_override_existing_values = 1
|
| 21 |
+
env_files = [".env", ".env.test"]
|
requirements-dev.txt
CHANGED
|
@@ -5,3 +5,4 @@ ruff
|
|
| 5 |
coverage
|
| 6 |
pytest-django
|
| 7 |
pytest-cov
|
|
|
|
|
|
| 5 |
coverage
|
| 6 |
pytest-django
|
| 7 |
pytest-cov
|
| 8 |
+
pytest-dotenv
|
src/quizsite/settings.py
CHANGED
|
@@ -21,6 +21,8 @@ env = environ.Env(
|
|
| 21 |
DBENGINE=(str, "django.db.backends.postgresql_psycopg2"),
|
| 22 |
DBSSL=(str, "disable"),
|
| 23 |
ADMIN_URL=(str, "admin/"),
|
|
|
|
|
|
|
| 24 |
)
|
| 25 |
|
| 26 |
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
@@ -154,11 +156,13 @@ STATIC_URL = "static/"
|
|
| 154 |
# https://whitenoise.evans.io/en/stable/django.html
|
| 155 |
STORAGES = {
|
| 156 |
"staticfiles": {
|
| 157 |
-
"BACKEND": "
|
| 158 |
},
|
| 159 |
}
|
| 160 |
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
|
| 161 |
|
|
|
|
|
|
|
| 162 |
# Default primary key field type
|
| 163 |
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
| 164 |
|
|
|
|
| 21 |
DBENGINE=(str, "django.db.backends.postgresql_psycopg2"),
|
| 22 |
DBSSL=(str, "disable"),
|
| 23 |
ADMIN_URL=(str, "admin/"),
|
| 24 |
+
STATIC_BACKEND=(str, "django.contrib.staticfiles.storage.StaticFilesStorage"),
|
| 25 |
+
WHITENOISE_MANIFEST_STRICT=(bool, False),
|
| 26 |
)
|
| 27 |
|
| 28 |
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
|
|
| 156 |
# https://whitenoise.evans.io/en/stable/django.html
|
| 157 |
STORAGES = {
|
| 158 |
"staticfiles": {
|
| 159 |
+
"BACKEND": env("STATIC_BACKEND"),
|
| 160 |
},
|
| 161 |
}
|
| 162 |
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
|
| 163 |
|
| 164 |
+
WHITENOISE_MANIFEST_STRICT = env("WHITENOISE_MANIFEST_STRICT")
|
| 165 |
+
|
| 166 |
# Default primary key field type
|
| 167 |
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
| 168 |
|