2022-07-26 03:20:15 +00:00
|
|
|
import debug_toolbar
|
2017-02-09 12:20:21 +00:00
|
|
|
from django.conf import settings
|
|
|
|
from django.contrib import admin
|
2023-06-26 08:27:43 +00:00
|
|
|
from django.urls import include, path, re_path
|
2022-07-26 03:20:15 +00:00
|
|
|
from wagtail import urls as wagtail_urls
|
2017-11-26 19:31:55 +00:00
|
|
|
from wagtail.admin import urls as wagtailadmin_urls
|
2018-05-22 20:14:14 +00:00
|
|
|
from wagtail.contrib.sitemaps.views import sitemap
|
2022-07-26 03:20:15 +00:00
|
|
|
from wagtail.documents import urls as wagtaildocs_urls
|
2023-06-26 08:27:43 +00:00
|
|
|
from wagtail.images.views.serve import ServeView
|
2017-02-09 12:20:21 +00:00
|
|
|
|
2017-02-10 13:05:54 +00:00
|
|
|
from bakerydemo.search import views as search_views
|
2022-07-26 03:20:15 +00:00
|
|
|
|
2018-05-22 20:17:07 +00:00
|
|
|
from .api import api_router
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
urlpatterns = [
|
2022-07-26 03:19:52 +00:00
|
|
|
path("django-admin/", admin.site.urls),
|
|
|
|
path("admin/", include(wagtailadmin_urls)),
|
|
|
|
path("documents/", include(wagtaildocs_urls)),
|
2023-06-26 08:27:43 +00:00
|
|
|
re_path(
|
|
|
|
r"^images/([^/]*)/(\d*)/([^/]*)/[^/]*$",
|
|
|
|
ServeView.as_view(),
|
|
|
|
name="wagtailimages_serve",
|
|
|
|
),
|
2022-07-26 03:19:52 +00:00
|
|
|
path("search/", search_views.search, name="search"),
|
|
|
|
path("sitemap.xml", sitemap),
|
|
|
|
path("api/v2/", api_router.urls),
|
|
|
|
path("__debug__/", include(debug_toolbar.urls)),
|
2017-02-09 12:20:21 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
if settings.DEBUG:
|
|
|
|
from django.conf.urls.static import static
|
|
|
|
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
|
|
|
from django.views.generic import TemplateView
|
2017-04-02 16:09:09 +00:00
|
|
|
from django.views.generic.base import RedirectView
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
# Serve static and media files from development server
|
|
|
|
urlpatterns += staticfiles_urlpatterns()
|
|
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
2017-04-02 16:09:09 +00:00
|
|
|
urlpatterns += [
|
2021-07-20 11:05:32 +00:00
|
|
|
path(
|
2022-07-26 03:19:52 +00:00
|
|
|
"favicon.ico",
|
|
|
|
RedirectView.as_view(url=settings.STATIC_URL + "img/bread-favicon.ico"),
|
2019-09-12 12:07:42 +00:00
|
|
|
)
|
2017-04-02 16:09:09 +00:00
|
|
|
]
|
2017-02-09 12:20:21 +00:00
|
|
|
|
|
|
|
# Add views for testing 404 and 500 templates
|
|
|
|
urlpatterns += [
|
2022-07-26 03:19:52 +00:00
|
|
|
path("test404/", TemplateView.as_view(template_name="404.html")),
|
|
|
|
path("test500/", TemplateView.as_view(template_name="500.html")),
|
2017-02-09 12:20:21 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
urlpatterns += [
|
2022-07-26 03:19:52 +00:00
|
|
|
path("", include(wagtail_urls)),
|
2017-02-09 12:20:21 +00:00
|
|
|
]
|