spejstore-new/spejstore/urls.py

41 lines
1.2 KiB
Python
Raw Normal View History

2016-09-29 20:20:10 +00:00
"""spejstore URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
"""
2024-01-12 17:56:27 +00:00
from django.urls import re_path, include
2016-09-29 20:20:10 +00:00
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
2017-03-06 15:50:55 +00:00
from rest_framework import routers
2016-09-29 20:20:10 +00:00
2017-03-06 15:50:55 +00:00
from storage import apiviews
2018-10-10 19:18:06 +00:00
from auth.views import auth_redirect
2017-03-06 15:50:55 +00:00
router = routers.DefaultRouter()
2023-07-11 13:34:35 +00:00
router.register(r"items", apiviews.ItemViewSet)
router.register(r"labels", apiviews.LabelViewSet)
2017-03-06 15:50:55 +00:00
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
2023-07-11 13:34:35 +00:00
urlpatterns = (
(
[
2024-01-12 17:56:27 +00:00
re_path(r"^admin/login/.*", auth_redirect),
2023-07-11 13:34:35 +00:00
]
if settings.PROD
else []
)
+ [
2024-01-12 17:56:27 +00:00
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)),
2023-07-11 13:34:35 +00:00
]
+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
2017-02-28 23:16:10 +00:00
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
2023-07-11 13:34:35 +00:00
)