fix: fix all dev static/media serving issues
- Remove WhiteNoise from MIDDLEWARE in development: it intercepts /static/ requests and serves from STATIC_ROOT, which is empty without collectstatic. Django's runserver serves static files natively with DEBUG=True. - Switch to StaticFilesStorage in dev: no manifest required. - Add media URL pattern in DEBUG mode: runserver does not serve MEDIA_ROOT automatically, so uploaded images were 404ing in local dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from django.views.generic import RedirectView
|
||||
@@ -21,3 +23,6 @@ urlpatterns = [
|
||||
path("admin/", RedirectView.as_view(url="/cms/", permanent=False)),
|
||||
path("", include(wagtail_urls)),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
Reference in New Issue
Block a user