56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
from django.conf import settings
|
|
from django.urls import path, re_path, include
|
|
from django.conf.urls.static import static
|
|
from django.contrib import admin
|
|
from django.views.generic import RedirectView
|
|
from wagtail.admin import urls as wagtailadmin_urls
|
|
from wagtail import urls as wagtail_urls
|
|
from wagtail.documents import urls as wagtaildocs_urls
|
|
from wagtail.images.views.serve import ServeView
|
|
|
|
from wagtailautocomplete.urls.admin import urlpatterns as autocomplete_admin_urls
|
|
|
|
from core import views
|
|
from core.views import override_wagtailadmin_explore_default_ordering
|
|
|
|
urlpatterns = [
|
|
# django admin
|
|
re_path(r"^guru/", admin.site.urls),
|
|
re_path(r"^statistics/", include("statistics.urls", namespace="statistics")),
|
|
# wagtail
|
|
re_path(r'^api/images/([^/]*)/(\d*)/([^/]*)/[^/]*$', ServeView.as_view(action='redirect'), name='wagtailimages_serve'),
|
|
|
|
re_path(r"^cms/autocomplete/", include(autocomplete_admin_urls)),
|
|
re_path(r"^cms/pages/(\d+)/$", override_wagtailadmin_explore_default_ordering),
|
|
re_path(r"^cms/", include(wagtailadmin_urls)),
|
|
re_path(r"^documents/", include(wagtaildocs_urls)),
|
|
|
|
|
|
# graphql backend
|
|
re_path(r"^api/", include("api.urls", namespace="api")),
|
|
|
|
# favicon
|
|
re_path(
|
|
r"^favicon\.ico$",
|
|
RedirectView.as_view(url="/static/favicon@2x.png", permanent=True),
|
|
),
|
|
]
|
|
|
|
if settings.DEBUG and not settings.USE_AWS:
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
|
|
if settings.DEBUG:
|
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
|
|
|
if settings.ENABLE_SILKY:
|
|
urlpatterns += [re_path(r"^silk/", include("silk.urls", namespace="silk"))]
|
|
|
|
# actually we use the cms in headless mode but need the url pattern to get the wagtail_serve function
|
|
urlpatterns += [
|
|
path(r"pages/", include(wagtail_urls)),
|
|
]
|
|
|
|
urlpatterns += [re_path(r"^.*$", views.home, name="home")]
|
|
|
|
admin.site.site_header = "Myskillbox Admin"
|