Add: whitenoise to manage staticfiles

This commit is contained in:
2023-08-30 01:17:57 +09:00
parent 30939755f7
commit 65b10e841c
15 changed files with 21 additions and 111 deletions

View File

@@ -34,6 +34,7 @@ INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'whitenoise.runserver_nostatic',
'django.contrib.staticfiles',
'collector.apps.CollectorConfig', # main app
'account.apps.AccountConfig', # account app
@@ -60,6 +61,7 @@ MIDDLEWARE = [
'django_otp.middleware.OTPMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
]
ROOT_URLCONF = 'logs_collector.urls'
@@ -127,11 +129,10 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
# Whitenoise:
# https://whitenoise.readthedocs.io/en/stable/django.html
STATIC_URL = 'static/'
STATICFILES_DIRS = [
BASE_DIR / "static",
]
STATIC_ROOT = BASE_DIR / 'static'
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field