Skip to content

Commit

Permalink
CSRF to deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
xinnie-ca committed Apr 4, 2024
1 parent e5faba9 commit c075407
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions lvlgg_backend/lvlgg_backend/deployment.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import os
from .settings import*

from .settings import *
from .settings import BASE_DIR

ALLOWED_HOSTS = [os.environ['WEBSITE_HOSTNAME']]
CSRF_TRUSTED_ORIGINS = ['https://' + os.environ['WEBSITE_HOSTNAME']]
ALLOWED_HOSTS = [os.environ["WEBSITE_HOSTNAME"]]
CSRF_TRUSTED_ORIGINS = ["https://" + os.environ["WEBSITE_HOSTNAME"]]
DEBUG = False
SECRET_KEY = os.environ['MY_SECRET_KEY']
SECRET_KEY = os.environ["MY_SECRET_KEY"]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"corsheaders.middleware.CorsMiddleware",
"django.middleware.common.CommonMiddleware",
Expand All @@ -19,28 +20,27 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

CORS_ALLOWED_ORIGINS = ['https://delightful-grass-08a6ea310.5.azurestaticapps.net']
CORS_ALLOWED_ORIGINS = ["https://delightful-grass-08a6ea310.5.azurestaticapps.net"]
CSRF_TRUSTED_ORIGINS = ["https://delightful-grass-08a6ea310.5.azurestaticapps.net"]

STORAGES = {
"default": {
"BACKEND": "django.core.files.storage.FileSystemStorage"
},
"staticfiles": {
"BACKEND": "whitenoise.storage.CompressedStaticFilesStorage"
}
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
"staticfiles": {"BACKEND": "whitenoise.storage.CompressedStaticFilesStorage"},
}

CONNECTION = os.environ['AZURE_POSTGRESQL_CONNECTIONSTRING']
CONNECTION_STR = {pair.split('=')[0]:pair.split('=')[1] for pair in CONNECTION.split(' ')}
CONNECTION = os.environ["AZURE_POSTGRESQL_CONNECTIONSTRING"]
CONNECTION_STR = {
pair.split("=")[0]: pair.split("=")[1] for pair in CONNECTION.split(" ")
}

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": CONNECTION_STR['dbname'],
"HOST": CONNECTION_STR['host'],
"USER": CONNECTION_STR['user'],
"PASSWORD": CONNECTION_STR['password'],
"NAME": CONNECTION_STR["dbname"],
"HOST": CONNECTION_STR["host"],
"USER": CONNECTION_STR["user"],
"PASSWORD": CONNECTION_STR["password"],
}
}

STATIC_ROOT = BASE_DIR/'staticfiles'
STATIC_ROOT = BASE_DIR / "staticfiles"

0 comments on commit c075407

Please sign in to comment.