Added and configured whitenoise

This commit is contained in:
Keannu Bernasol 2023-06-26 22:10:29 +08:00
parent b6d7decf3a
commit ca527289af
4 changed files with 16 additions and 1 deletions

1
.gitignore vendored
View file

@ -63,6 +63,7 @@ db.sqlite3-journal
# Static Media Stuff
stude/media/*
stude/static/*
# Flask stuff:
instance/

View file

@ -9,6 +9,7 @@ djangorestframework = "*"
python-dotenv = "*"
djoser = "*"
pillow = "*"
whitenoise = "*"
[dev-packages]

10
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "7f8c112b62413d4c6d5b8faf2ca1dd84514614956bfd75e58491781725258ba4"
"sha256": "7a186c2a779282b0072d0634e264e5e70842a4c9676dfc4d1e18e564860e87c8"
},
"pipfile-spec": 6,
"requires": {
@ -434,6 +434,14 @@
],
"markers": "python_version >= '3.7'",
"version": "==2.0.3"
},
"whitenoise": {
"hashes": [
"sha256:15fe60546ac975b58e357ccaeb165a4ca2d0ab697e48450b8f0307ca368195a8",
"sha256:16468e9ad2189f09f4a8c635a9031cc9bb2cdbc8e5e53365407acf99f7ade9ec"
],
"index": "pypi",
"version": "==6.5.0"
}
},
"develop": {}

View file

@ -67,6 +67,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
"whitenoise.middleware.WhiteNoiseMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
@ -75,6 +76,10 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
STATIC_URL = 'static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
ROOT_URLCONF = 'config.urls'
TEMPLATES = [