Sometimes, we want to fix Python Django cannot find static files.
In this article, we’ll look at how to fix Python Django cannot find static files.
How to fix Python Django cannot find static files?
To fix Python Django cannot find static files, we can specify the template directory explicitly.
For instance, in settings.py, we write
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
to set STATICFILES_DIRS
to a list of folders with the static file paths.