0 day streak
python / beginner
Snippet

Configuring Static Files

To serve CSS, JavaScript, and images, you must define where Django looks for these files during development using the STATICFILES_DIRS setting.

snippet.py
python
1
2
3
4
5
# settings.py
STATIC_URL = 'static/'
STATICFILES_DIRS = [
BASE_DIR / "static",
]
django
Breakdown
1
STATIC_URL = 'static/'
The URL prefix used when referring to static files in templates.
2
STATICFILES_DIRS = [ ... ]
A list of filesystem directories where Django will search for additional static files.