Commit 5ce8e169 authored by Ilham Maulana's avatar Ilham Maulana 💻

fix: serve media files

parent 6c126aa6
...@@ -27,11 +27,11 @@ BASE_DIR = Path(__file__).resolve().parent.parent ...@@ -27,11 +27,11 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get("SECRET_KEY") SECRET_KEY = os.environ.get("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = True
ALLOWED_HOSTS = [ ALLOWED_HOSTS = [
"localhost", "localhost",
"127.0.0.1", "127.0.0.1",
os.environ.get("IP_HOST"), "192.168.2.252",
"library_app.ilhammaulana.me", "library_app.ilhammaulana.me",
] ]
...@@ -66,8 +66,6 @@ MIDDLEWARE = [ ...@@ -66,8 +66,6 @@ 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"
...@@ -150,7 +148,7 @@ USE_TZ = True ...@@ -150,7 +148,7 @@ USE_TZ = True
# 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 / "static" STATIC_ROOT = BASE_DIR / "staticfiles"
MEDIA_URL = "/media/" MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR MEDIA_ROOT = BASE_DIR
...@@ -178,9 +176,3 @@ EMAIL_HOST_PASSWORD = "83VFaB6ZGSzy72D24T" ...@@ -178,9 +176,3 @@ EMAIL_HOST_PASSWORD = "83VFaB6ZGSzy72D24T"
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
STORAGES = {
"staticfiles": {
"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