update media url and context processor

This commit is contained in:
2025-01-26 13:13:09 +01:00
parent 5cac8f8275
commit 57b3e2144e

View File

@@ -106,9 +106,26 @@ EMAIL_PORT = 587
EMAIL_USE_TLS = True EMAIL_USE_TLS = True
# STATIC FILES
if DEBUG:
STATIC_URL = "static/"
else:
STATIC_URL = "assets/"
# Use for collectstatic/production folder.
# --- Saving directory for production folder.
STATIC_ROOT = "assets/"
# --- Get files from following directory for production folder.
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "gallery/static"),
os.path.join(BASE_DIR, "static"),
]
# FILE UPLOADS # FILE UPLOADS
MEDIA_ROOT = os.path.join(BASE_DIR, "files/")
MEDIA_URL = "files/" MEDIA_URL = "files/"
MEDIA_ROOT = os.path.join(BASE_DIR, "files")
# GLOBALIZATION # GLOBALIZATION
@@ -174,20 +191,6 @@ DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
SITE_ID = 1 SITE_ID = 1
# STATIC FILES
STATIC_ROOT = "assets/"
if DEBUG:
STATIC_URL = "static/"
else:
STATIC_URL = "assets/"
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "gallery/static"),
os.path.join(BASE_DIR, "static"),
]
# SECURITY # SECURITY
# TODO: Security Warning # TODO: Security Warning
# CSRF_COOKIE_SECURE = True # CSRF_COOKIE_SECURE = True
@@ -216,6 +219,7 @@ TEMPLATES = [
"django.contrib.auth.context_processors.auth", "django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages", "django.contrib.messages.context_processors.messages",
"django.template.context_processors.i18n", "django.template.context_processors.i18n",
"django.template.context_processors.media",
], ],
}, },
}, },