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: The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/ 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.contrib import admin
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
@ -24,16 +24,16 @@ router.register(r"labels", apiviews.LabelViewSet)
urlpatterns = ( urlpatterns = (
( (
[ [
url(r"^admin/login/.*", auth_redirect), re_path(r"^admin/login/.*", auth_redirect),
] ]
if settings.PROD if settings.PROD
else [] else []
) )
+ [ + [
url(r"^admin/", admin.site.urls), re_path(r"^admin/", admin.site.urls),
url(r"^select2/", include("django_select2.urls")), re_path(r"^select2/", include("django_select2.urls")),
url(r"^", include("storage.urls")), re_path(r"^", include("storage.urls")),
url(r"^api/1/", include(router.urls)), re_path(r"^api/1/", include(router.urls)),
] ]
+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_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 ( from storage.views import (
index, index,
search, search,
@ -10,12 +10,14 @@ from storage.views import (
) )
urlpatterns = [ urlpatterns = [
url(r"^$", index), re_path(r"^$", index),
url(r"^search$", search), re_path(r"^search$", search),
url(r"^apitoken$", apitoken), re_path(r"^apitoken$", apitoken),
url(r"^item/(?P<pk>.*)$", item_display, name="item-display"), re_path(r"^item/(?P<pk>.*)$", item_display, name="item-display"),
url(r"^autocomplete.json$", ItemSelectView.as_view(), name="item-complete"), re_path(r"^autocomplete.json$", ItemSelectView.as_view(), name="item-complete"),
url(r"^autocomplete_prop.json$", PropSelectView.as_view(), name="prop-complete"), re_path(
url(r"^(?P<pk>[^/]*)$", label_lookup, name="label-lookup"), r"^autocomplete_prop.json$", PropSelectView.as_view(), name="prop-complete"
url("", include("social_django.urls", namespace="social")), ),
re_path(r"^(?P<pk>[^/]*)$", label_lookup, name="label-lookup"),
re_path("", include("social_django.urls", namespace="social")),
] ]