url(regex=r'^token-auth/', view=obtain_jwt_token), url(regex=r"^(?P<version>(v1))/lots/(?P<pk>[0-9]+)/", view=LotDetailAPIView.as_view(), name="lot-detail"), url(regex=r"(?P<version>(v1))/lots/search/?$", view=LotSearchAPIView.as_view(), name="lot-search"), url(regex=r"(?P<version>(v1))/lots/", view=LotListAPIView.as_view(), name="lot-list"), url(regex=r"^(?P<version>(v1))/brands/(?P<pk>[0-9]+)/", view=BrandDetailAPIView.as_view(), name="brand-detail"), url(regex=r"(?P<version>(v1))/brands/search/?$", view=BrandSearchAPIView.as_view(), name="brand-search"), url(regex=r"(?P<version>(v1))/brands/", view=BrandListAPIView.as_view(), name="brand-list"), url(regex=r"^(?P<version>(v1))/products/(?P<pk>[0-9]+)/", view=ProductDetailAPIView.as_view(), name="product-detail"), url(regex=r"(?P<version>(v1))/products/search/?$", view=ProductSearchAPIView.as_view(), name="product-search"), url(regex=r"(?P<version>(v1))/products/", view=ProductListAPIView.as_view(), name="product-list"), url(regex=r'^', view=wrong_url), ]
from django.urls import path from api.views import CategoryViewSet, ProductListAPIView, ProductDetailAPIView, CommentViewSet, product_comment, \ category_product from rest_framework import routers router = routers.SimpleRouter() router.register('categories', CategoryViewSet, basename='api') router.register('comments', CommentViewSet, basename='api') # router.register('products', ProductAPIView, basename='api') urlpatterns = [ path('products/', ProductListAPIView.as_view()), path('products/<int:pk>/', ProductDetailAPIView.as_view()), path('products/<int:pk>/comments/', product_comment), path('categories/<int:pk>/products/', category_product), ] urlpatterns += router.urls
from django.contrib import admin from django.urls import path, include from django.conf.urls.static import static from django.conf import settings from api.views import ProductListAPIView, ProductDetailsView urlpatterns = [ path('admin/', admin.site.urls), path('api/', include('api.urls')), path('api/list/', ProductListAPIView.as_view(), name='api-list'), path('api/details/<int:id>/', ProductDetailsView.as_view(), name='api-details') ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)