Serving media
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ekaropolus 2026-01-04 15:50:23 -06:00
parent 8eeaecbc2d
commit 48adb556a5
2 changed files with 3 additions and 0 deletions

View File

@ -159,6 +159,7 @@ STATICFILES_DIRS = [
MEDIA_URL = "/media/" MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "media" MEDIA_ROOT = BASE_DIR / "media"
SERVE_MEDIA = os.getenv("SERVE_MEDIA", "").lower() in ("1", "true", "yes")
# Default primary key field type # Default primary key field type

View File

@ -65,4 +65,6 @@ urlpatterns = [
if settings.DEBUG: if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
if settings.DEBUG or settings.SERVE_MEDIA:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)