Add urls for market app
This commit is contained in:
parent
42deebb758
commit
572c7780af
@ -15,8 +15,9 @@ Including another URLconf
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
path("", include("market.urls")),
|
||||
]
|
||||
|
16
market/urls.py
Normal file
16
market/urls.py
Normal file
@ -0,0 +1,16 @@
|
||||
from django.conf import settings
|
||||
|
||||
from rest_framework import routers
|
||||
|
||||
from .viewsets import BrandViewset, PostViewset, ProductViewset
|
||||
|
||||
if settings.DEBUG:
|
||||
router = routers.DefaultRouter()
|
||||
else:
|
||||
router = routers.SimpleRouter()
|
||||
|
||||
router.register("brands", BrandViewset)
|
||||
router.register("products", ProductViewset)
|
||||
router.register("posts", PostViewset)
|
||||
|
||||
urlpatterns = router.urls
|
Loading…
Reference in New Issue
Block a user