from django.conf.urls import url, include from rest_framework import routers from .views import KeywordMissionViewSet, DateMissionViewSet, TimeMissionViewSet, PageMissionViewSet, UserViewSet router = routers.DefaultRouter() router.register(r'keyword_mission', KeywordMissionViewSet, basename="keywordmission") router.register(r'user', UserViewSet, basename="user") router.register(r'date_mission', DateMissionViewSet, basename="datemission") router.register(r'time_mission', TimeMissionViewSet, basename="timemission") router.register(r'page_mission', PageMissionViewSet, basename="pagemission") # 使用自动URL路由连接API。 # 另外,我们还包括支持浏览器浏览API的登录URL。 urlpatterns = [ url(r'^', include(router.urls)), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), ]