Add support for serving static files

This commit is contained in:
2023-01-17 19:02:23 +01:00
parent eecd62f5b2
commit d0494c8370
7 changed files with 235 additions and 2 deletions
+2
View File
@@ -44,6 +44,7 @@ REST_FRAMEWORK = {
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
"whitenoise.middleware.WhiteNoiseMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
@@ -120,6 +121,7 @@ USE_TZ = True
STATICFILES_DIRS = [ BASE_DIR / "static"]
STATIC_ROOT = "deploy/static/"
STATIC_URL = 'static/'
STATICFILES_STORAGE = env("STATICFILES_STORAGE", default="whitenoise.storage.CompressedStaticFilesStorage")
# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field