Skip to content

Commit 8966b52

Browse files
committed
feat: add and configure static files
1 parent aaa578d commit 8966b52

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.tmp
66
*.egg-info
77
static/
8+
!pems/static
89
__pycache__/
910
.coverage
1011
.DS_Store

pems/settings.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,25 @@ def _filter_empty(ls):
113113
# Static files (CSS, JavaScript, Images)
114114
# https://docs.djangoproject.com/en/5.1/howto/static-files/
115115

116-
STATIC_URL = "static/"
116+
STATIC_URL = "/static/"
117+
118+
STATICFILES_DIRS = [os.path.join(BASE_DIR, "pems", "static")]
119+
120+
# use Manifest Static Files Storage by default
121+
STORAGES = {
122+
"default": {
123+
"BACKEND": "django.core.files.storage.FileSystemStorage",
124+
},
125+
"staticfiles": {
126+
"BACKEND": os.environ.get(
127+
"DJANGO_STATICFILES_STORAGE", "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
128+
)
129+
},
130+
}
117131

118132
STATIC_ROOT = os.path.join(BASE_DIR, "static")
119133

134+
120135
# Default primary key field type
121136
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
122137

pems/static/img/caltranslogo.png

6.84 KB
Loading

0 commit comments

Comments
 (0)