1
0
Fork 0

fix: use proper uri rewrites

This commit is contained in:
Dariusz Niemczyk 2024-01-12 18:56:27 +01:00
parent ee2c93908a
commit f94e7b3207
No known key found for this signature in database
2 changed files with 17 additions and 15 deletions

View File

@ -3,7 +3,7 @@
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
"""
from django.conf.urls import url, include
from django.urls import re_path, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
@ -24,16 +24,16 @@ router.register(r"labels", apiviews.LabelViewSet)
urlpatterns = (
(
[
url(r"^admin/login/.*", auth_redirect),
re_path(r"^admin/login/.*", auth_redirect),
]
if settings.PROD
else []
)
+ [
url(r"^admin/", admin.site.urls),
url(r"^select2/", include("django_select2.urls")),
url(r"^", include("storage.urls")),
url(r"^api/1/", include(router.urls)),
re_path(r"^admin/", admin.site.urls),
re_path(r"^select2/", include("django_select2.urls")),
re_path(r"^", include("storage.urls")),
re_path(r"^api/1/", include(router.urls)),
]
+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -1,4 +1,4 @@
from django.conf.urls import include, url
from django.urls import re_path, include
from storage.views import (
index,
search,
@ -10,12 +10,14 @@ from storage.views import (
)
urlpatterns = [
url(r"^$", index),
url(r"^search$", search),
url(r"^apitoken$", apitoken),
url(r"^item/(?P<pk>.*)$", item_display, name="item-display"),
url(r"^autocomplete.json$", ItemSelectView.as_view(), name="item-complete"),
url(r"^autocomplete_prop.json$", PropSelectView.as_view(), name="prop-complete"),
url(r"^(?P<pk>[^/]*)$", label_lookup, name="label-lookup"),
url("", include("social_django.urls", namespace="social")),
re_path(r"^$", index),
re_path(r"^search$", search),
re_path(r"^apitoken$", apitoken),
re_path(r"^item/(?P<pk>.*)$", item_display, name="item-display"),
re_path(r"^autocomplete.json$", ItemSelectView.as_view(), name="item-complete"),
re_path(
r"^autocomplete_prop.json$", PropSelectView.as_view(), name="prop-complete"
),
re_path(r"^(?P<pk>[^/]*)$", label_lookup, name="label-lookup"),
re_path("", include("social_django.urls", namespace="social")),
]