Commit 951a02a1 authored by Ilham Maulana's avatar Ilham Maulana 💻

fix: staticfiles settings

parent 8c784eab
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
media media
uploads uploads
static static
staticfiles
# Backup files # # Backup files #
*.bak *.bak
......
...@@ -68,6 +68,8 @@ MIDDLEWARE = [ ...@@ -68,6 +68,8 @@ MIDDLEWARE = [
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
# local # local
"users.middleware.AuthMiddleware", "users.middleware.AuthMiddleware",
# 3rd party
"whitenoise.middleware.WhiteNoiseMiddleware",
] ]
ROOT_URLCONF = "config.urls" ROOT_URLCONF = "config.urls"
...@@ -149,8 +151,9 @@ USE_TZ = True ...@@ -149,8 +151,9 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/ # https://docs.djangoproject.com/en/5.0/howto/static-files/
STATIC_URL = "/static/" STATIC_URL = "static/"
STATIC_ROOT = BASE_DIR / "staticfiles" STATIC_ROOT = BASE_DIR / "staticfiles"
STATICFILES_DIRS = [BASE_DIR / "static"]
MEDIA_URL = "/media/" MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR MEDIA_ROOT = BASE_DIR
...@@ -160,7 +163,7 @@ STORAGES = { ...@@ -160,7 +163,7 @@ STORAGES = {
"BACKEND": "django.core.files.storage.FileSystemStorage", "BACKEND": "django.core.files.storage.FileSystemStorage",
}, },
"staticfiles": { "staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment