spejstore/spejstore/urls.py

41 lines
1.1 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/
"""
from django.conf.urls import url, 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 = (
(
[
url(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)),
]
+ 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
)