Skip to content

Commit

Permalink
Updated settings config for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Fer-Bar committed May 27, 2024
1 parent 900c603 commit df9e26e
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions albercan_backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')
SECRET_KEY = env("SECRET_KEY")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.BOOL('DEBUG', False)
DEBUG = env.BOOL("DEBUG", False)

ALLOWED_HOSTS = env.LIST('ALLOWED_HOSTS', [])
ALLOWED_HOSTS = env.LIST("ALLOWED_HOSTS", [])

# Application definition

Expand All @@ -42,11 +42,12 @@
"people",
"pet",
"structure",
"authentication"
"authentication",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
Expand All @@ -60,7 +61,7 @@
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_DIR / PROJECT_NAME / 'templates'],
"DIRS": [BASE_DIR / PROJECT_NAME / "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand Down Expand Up @@ -136,14 +137,21 @@
STATIC_ROOT = env("STATIC_ROOT") # This is when I run the app in prod
STATIC_ROOT = f"{(BASE_DIR / STATIC_ROOT).absolute()}" if STATIC_ROOT else None

STATICFILES_DIRS = [
BASE_DIR / PROJECT_NAME / "static"
]
STATICFILES_DIRS = [BASE_DIR / PROJECT_NAME / "static"]

STORAGES = {
"default": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
},
"staticfiles": {
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
},
}
# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

LOGIN_REDIRECT_URL = "/index"
LOGOUT_REDIRECT_URL = "/auth/login"
CSRF_COOKIE_SECURE = True

0 comments on commit df9e26e

Please sign in to comment.