Add whitenoise for static files
This commit is contained in:
parent
e4d652ac6b
commit
65c08dc1bb
3 changed files with 11 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -214,3 +214,4 @@ dmypy.json
|
|||
# End of https://www.gitignore.io/api/node,python
|
||||
|
||||
env/
|
||||
collected-static
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
django==3.0.5
|
||||
django-debug-toolbar==2.2
|
||||
whitenoise==5.0.1
|
||||
brotli==1.0.7
|
||||
|
|
|
@ -30,10 +30,15 @@ ALLOWED_HOSTS = "*"
|
|||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = ["django.contrib.staticfiles", "debug_toolbar"]
|
||||
INSTALLED_APPS = [
|
||||
"whitenoise.runserver_nostatic",
|
||||
"django.contrib.staticfiles",
|
||||
"debug_toolbar",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
|
@ -72,6 +77,8 @@ USE_TZ = True
|
|||
# https://docs.djangoproject.com/en/3.0/howto/static-files/
|
||||
|
||||
STATIC_URL = "/static/"
|
||||
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "collected-static")
|
||||
|
||||
|
||||
INTERNAL_IPS = [
|
||||
|
|
Reference in a new issue