Skip to content

Commit

Permalink
bump django
Browse files Browse the repository at this point in the history
  • Loading branch information
kahlstrm committed May 12, 2024
1 parent 89ff9a3 commit f7bc462
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
django==4.1.13
django==4.2.13
psycopg2
django-storages[azure]
argon2-cffi
Expand Down
47 changes: 28 additions & 19 deletions tenttiarkisto/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,46 @@
from django.core.exceptions import ImproperlyConfigured
from tenttiarkisto.settings import *


def get_env_var(name):
value = environ.get(name)
if not value:
raise ImproperlyConfigured(f'Missing env variable: {name}')
return value
value = environ.get(name)
if not value:
raise ImproperlyConfigured(f"Missing env variable: {name}")
return value


DEBUG = False

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': get_env_var('DB_NAME'),
'USER': get_env_var('DB_USER'),
'PASSWORD': get_env_var('DB_PASSWORD'),
'HOST': get_env_var('DB_HOST'),
'PORT': environ.get('DB_PORT', ''),
'OPTIONS': { 'sslmode': 'require' },
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": get_env_var("DB_NAME"),
"USER": get_env_var("DB_USER"),
"PASSWORD": get_env_var("DB_PASSWORD"),
"HOST": get_env_var("DB_HOST"),
"PORT": environ.get("DB_PORT", ""),
"OPTIONS": {"sslmode": "require"},
}
}

DEFAULT_FILE_STORAGE = 'storages.backends.azure_storage.AzureStorage'
STORAGES = {
"default": {
"BACKEND": "storages.backends.azure_storage.AzureStorage",
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
}

AZURE_ACCOUNT_NAME = get_env_var('EXAM_ACCOUNT_NAME')
AZURE_ACCOUNT_KEY = get_env_var('EXAM_ACCOUNT_KEY')
AZURE_CONTAINER = get_env_var('EXAM_CONTAINER')
AZURE_ACCOUNT_NAME = get_env_var("EXAM_ACCOUNT_NAME")
AZURE_ACCOUNT_KEY = get_env_var("EXAM_ACCOUNT_KEY")
AZURE_CONTAINER = get_env_var("EXAM_CONTAINER")

SECRET_KEY = get_env_var('SECRET_KEY')
SECRET_KEY = get_env_var("SECRET_KEY")

ALLOWED_HOSTS = get_env_var('ALLOWED_HOSTS').split(',')
ALLOWED_HOSTS = get_env_var("ALLOWED_HOSTS").split(",")

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

LOGGING = {
"version": 1,
Expand Down

0 comments on commit f7bc462

Please sign in to comment.