Created
July 29, 2025 17:45
-
-
Save BrunoMoreno/5d4de435a76f700d7d4edfae7ef01ea9 to your computer and use it in GitHub Desktop.
django static files config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # settings.py | |
| STATIC_URL = 'static/' | |
| STATICFILES_DIRS = [ | |
| BASE_DIR / "static", | |
| ] | |
| MEDIA_URL = '/media/' | |
| MEDIA_ROOT = BASE_DIR / 'media' | |
| # urls.py | |
| from django.conf import settings | |
| from django.conf.urls.static import static | |
| # in the end of file | |
| # if settings.DEBUG: | |
| urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | |
| urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment