diff --git a/config/urls.py b/config/urls.py index 92decab..469665f 100644 --- a/config/urls.py +++ b/config/urls.py @@ -20,4 +20,5 @@ from django.urls import include, path urlpatterns = [ path("admin/", admin.site.urls), path("", include("market.urls")), + path("user/", include("user.urls")), ] diff --git a/user/urls.py b/user/urls.py new file mode 100644 index 0000000..5c74280 --- /dev/null +++ b/user/urls.py @@ -0,0 +1,20 @@ +from django.conf import settings +from django.urls import path + +from rest_framework import routers + +from .views import login_view, logout_view +from .viewsets import UserViewset + + +if settings.DEBUG: + router = routers.DefaultRouter() +else: + router = routers.SimpleRouter() + +router.register("users", UserViewset) + +urlpatterns = router.urls + [ + path("login/", login_view), + path("logout/", logout_view), +]