Przeglądaj źródła

Enable Wagtail’s dynamic image serve view

Thibaud Colas 1 rok temu
rodzic
commit
1dbd728ad9
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      bakerydemo/urls.py

+ 7 - 1
bakerydemo/urls.py

@@ -1,11 +1,12 @@
 import debug_toolbar
 from django.conf import settings
 from django.contrib import admin
-from django.urls import include, path
+from django.urls import include, path, re_path
 from wagtail import urls as wagtail_urls
 from wagtail.admin import urls as wagtailadmin_urls
 from wagtail.contrib.sitemaps.views import sitemap
 from wagtail.documents import urls as wagtaildocs_urls
+from wagtail.images.views.serve import ServeView
 
 from bakerydemo.search import views as search_views
 
@@ -15,6 +16,11 @@ urlpatterns = [
     path("django-admin/", admin.site.urls),
     path("admin/", include(wagtailadmin_urls)),
     path("documents/", include(wagtaildocs_urls)),
+    re_path(
+        r"^images/([^/]*)/(\d*)/([^/]*)/[^/]*$",
+        ServeView.as_view(),
+        name="wagtailimages_serve",
+    ),
     path("search/", search_views.search, name="search"),
     path("sitemap.xml", sitemap),
     path("api/v2/", api_router.urls),