UserFavCourseViewSet, base_name="userfavcourse") router.register(r'usersketch', UserSketchViewSet, base_name="usersketch") router.register(r'sketch', SketchListViewSet, base_name="sketch") router.register(r'usercourse', UserCourseViewSet, base_name="usercourse") router.register(r'userenroll', UserEnrollViewSet, base_name="userenroll") router.register(r'salesinfo', SalesInfoViewSet, base_name="salesinfo") router.register(r'userdeadline', UserDeadlineViewSet, base_name="userdeadline") urlpatterns = [ url(r'^new-login/', auth.login, name="new-login"), url(r'^api/', include(router.urls), name="api"), # url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), # url(r'^tracking/', include('tracking.urls')), url(r'^xadmin/', xadmin.site.urls), url(r'ueditor/', include('DjangoUeditor.urls')), url(r'docs/', include_docs_urls(title="文档功能")), url(r'^login/$', obtain_jwt_token, name="login"), url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}), url(r'^alipay/return/', AliPayView.as_view(), name="alipay"), # url(r'^api/v1/accounts/', include('accounts.urls', namespace='accounts')), url(r'^api/v1/getdata/', include('base.urls')), # catch all others because of how history is handled by react router - cache this page because it will never change url(r'^', cache_page(settings.PAGE_CACHE_SECONDS)( base_views.IndexView.as_view()), name='index'), ]
# 首页系列商品展示url router.register(r'indexgoods', IndexCategoryViewset, base_name="indexgoods") # goods_list = GoodsListViewSet.as_view({ # 'get': 'list', # }) urlpatterns = [ path('xadmin/', xadmin.site.urls), path('ueditor/', include('DjangoUeditor.urls')), url(r'^api-auth/', include('rest_framework.urls')), # 文件 path('media/<path:path>', serve, {'document_root': MEDIA_ROOT}), #商品列表页 # url(r'goods/$',GoodsListView.as_view(),name="good-list"), #文档 url(r'docs/', include_docs_urls(title="海鲜商城")), url(r'^', include(router.urls)), #drf自带的token认证模式 url(r'^api-token-auth/', views.obtain_auth_token), #JWT的认证接口 url(r'^login/', obtain_jwt_token), # url(r'goods/$',GoodsListViewSet.as_view()) # url(r'^goods/$', goods_list, name='goods-list'), # 首页 url(r'^index/', TemplateView.as_view(template_name="index.html"), name="index"), # 配置支付宝支付相关接口的url path('alipay/return/', AliPayView.as_view()), ]
router.register(r'orders', OrderInfoViewSet, base_name='orders') router.register(r'banners', BannerViewSet, base_name='banners') router.register(r'indexgoods', IndexCategoryViewSet, base_name='indexgoods') # good_list = GoodsListViewSet.as_view({ # #get请求绑定ListModelMixin的list方法 # 'get': 'list', # }) urlpatterns = [ # url(r'^admin/', admin.site.urls), url(r'^xadmin/', xadmin.site.urls), url(r'^ueditor/', include('DjangoUeditor.urls')), url(r'^media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}), # url(r'^static/(?P<path>.*)',serve, {'document_root': STATIC_ROOT}), url(r'^docs/', include_docs_urls(title='硅谷商店')), # docs 文档 url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^api-token-auth', views.obtain_auth_token), # token 认证 # url(r'^jwt-token-auth',obtain_jwt_token), # jwt 认证 url(r'^login/$', obtain_jwt_token), # jwt 认证 # url(r'^goods_test/$',GoodsListViewRequestResponse.as_view(),name='goods_test'), # url(r'^goods/$',good_list, name='goods_list') url(r'^', include(router.urls)), # 首页 展示路由 url(r'^alipay/return', AliPayView.as_view(), name='alipay'), # 支付宝 回调 url(r'^index/', TemplateView.as_view(template_name='index.html'), name='index'), #前端项目 url(r'', include('social_django.urls', namespace='social')), # 第三方登录url配置 ]
router.register(r'orders', OrderViewset, basename='orders') #轮播商品 router.register(r'banners', BannerViewset, basename='banners') #首页商品分类系列数据 router.register(r'indexgoods', IndexCategoryViewset, basename='indexgoods') from trade.views import AliPayView from django.views.generic import TemplateView urlpatterns = [ path('admin/', admin.site.urls), #商品列表页 # path(r'goods/',good_list,name='goods-list'), path(r'api-auth/', include('rest_framework.urls', namespace='rest_framwork')), path(r'docs/', include_docs_urls(title='生鲜商场')), path(r'', include(router.urls)), path(r'api-token-auth/', views.obtain_auth_token), #drf自带的认证接口 path(r'login/', obtain_jwt_token), path(r'alipay/return/', AliPayView.as_view(), name='alipay'), path(r'index/', TemplateView.as_view(template_name='index.html'), name='index'), #第三方登录url ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
## 用户动作 收藏 留言 收货 router.register(r'userfavs', UserFavViewset, base_name='userfavs') router.register(r'messages', LeavingMessageViewset, base_name='messages') router.register('address', AddressViewset, base_name='address') ## 购物车 订单 router.register(r'shopcarts', ShoppingCartViewset, base_name='shopcarts') router.register(r'orders', OrderViewset, base_name='orders') urlpatterns = [ # path('admin/', admin.site.urls), path('admin/', xadmin.site.urls), path('ueditor/', include('DjangoUeditor.urls')), path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), # path('api/', include(myapp.urls)), ## 生成文档 ## pip install coreapi django-rest-swagger ## >_> cool~ path('docs', include_docs_urls(title='docs')), path('index/', TemplateView.as_view(template_name='index.html'), name='index'), path('login/', obtain_jwt_token), path('', include(router.urls)), ###处理url 显示路径 re_path('media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}), path('alipay/return/', AliPayView.as_view(), name="alipay"), ]
from django.views.generic import TemplateView router = routers.DefaultRouter() router.register(r'goods', GoodsViewSet, basename='goods') # 这里就是接口定义的位置 router.register(r'categorys', CategoryViewSet, basename='categorys') router.register(r'code', VerifyCodeViewSet, basename='code') router.register(r'users', UserViewSet, basename='users') router.register(r'userfavs', UserFavViewSet, basename='userfavs') router.register(r'messages', UserLeavingMessageViewSet, basename='messages') router.register(r'address', UserAddressViewSet, basename='address') router.register(r'shopcarts', ShopCartViewSet, basename='shopcarts') router.register(r'orders', OrderInfoViewSet, basename='orders') router.register(r'banners', IndexBannersViewSet, basename='banners') urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url(r'^media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}), url(r'^ueditor/', include('DjangoUeditor.urls')), # url(r'^goods/$', GoodsView.as_view()), # url(r'^goods/$', GoodsView.as_view({'get': 'list'})), url(r'^api-auth/', include('rest_framework.urls')), # browser api 的登陆/退出 url(r'', include(router.urls)), # # 这是token 登陆-认证方式 # url(r'^login/', views.obtain_auth_token), # 这里已经把login的post请求给我们做了 # 这是JWT Token 登陆-认证方式 url(r'^login/', obtain_jwt_token), url(r'^alipay_return/$', AliPayView.as_view(), name='alipay'), url(r'^index/$', TemplateView.as_view(template_name='index.html'), name='index'), ]
# from goods.nomodeviews import HandelGoodsView # TODO viwset 和 router 之间怎么调用的逻辑需要进一步源码分型 router = DefaultRouter() router.register(r'goods', GoodsViewSet, base_name='goods') router.register(r'categorys', CategoryViewSet, base_name='categorys') router.register(r'codes', SendSMSViewSet, base_name='codes') router.register(r'users', UserViewSet, base_name='users') router.register(r'userfavs', UserFavViewSet, base_name='user_favs') router.register(r'shopcart', ShoppingCartViewSet, base_name='shop_cart') router.register(r'order', OrderViewSet, base_name='order') router.register(r'indexcategory', IndexCategoryViewSet, base_name='indexcategory') urlpatterns = [ path('xadmin/', xadmin.site.urls), path('', include(router.urls)), path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), re_path(r'^docs/', include_docs_urls(title='慕学生鲜')), re_path(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}), # rest_framework token 认证 re_path(r'^api-token-auth', views.obtain_auth_token), # jwt token 认证 re_path(r'^login', obtain_jwt_token), re_path(r'^alipay/return', AliPayView.as_view(), name="alipay"), # re_path(r'^handle', HandelGoodsView.as_view(), name="handle") ]
url('media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}), url('doc/', include_docs_urls(title='文档')), url('xadmin/', xadmin.site.urls), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url('', include(router.urls)), url(r'^index/', TemplateView.as_view(template_name="index.html"), name="index"), #drf自带的token认证模式 # url(r'^api-token-auth/', views.obtain_auth_token), # drf的认证接口 url(r'^login/$', obtain_jwt_token), url(r'^apipay/return/', AliPayView.as_view(), name='alipay'), # 第三方登录 url('', include('social_django.urls', namespace='social')), ] from django.conf import settings if settings.DEBUG: import debug_toolbar urlpatterns = [ # path('__debug__/', include(debug_toolbar.urls)), # For django versions before 2.0: url(r'^__debug__/', include(debug_toolbar.urls)), ] + urlpatterns
from goods.views import IndexBannerViewSet, CategoryViewSet, GoodsViewSet from users.views import GenerateCaptchaView, SmsCodeView, UserViewSet, AddressViewSet, UserInfoViewSet from operations.views import UserFavViewSet from trade.views import ShoppingCartViewSet, OrderViewSet, GoodsCommentViewSet, GoodsDetailCommentViewSet, AliPayView from rest_framework_jwt.views import obtain_jwt_token from rest_framework.documentation import include_docs_urls router = routers.DefaultRouter() router.register(r'api/index_banner', IndexBannerViewSet) router.register(r'api/category', CategoryViewSet) router.register(r'api/goods', GoodsViewSet) router.register(r'api/user_info', UserInfoViewSet) router.register(r'api/user', UserViewSet) router.register(r'api/user_fav', UserFavViewSet) router.register(r'api/user_address', AddressViewSet) router.register(r'api/shopping_cart', ShoppingCartViewSet) router.register(r'api/order', OrderViewSet) router.register(r'api/goods_comment', GoodsCommentViewSet) router.register(r'api/goods_detail_comment', GoodsDetailCommentViewSet) urlpatterns = [ path('admin/', admin.site.urls), path('captcha/<uuid:uuid>', GenerateCaptchaView.as_view()), path('api/sms_code/', SmsCodeView.as_view()), path('api/pay/', AliPayView.as_view()), path('', include(router.urls)), path('api/docs/', include_docs_urls(title='阳哥商城')), path('api/login/', obtain_jwt_token), path('media/<path:path>', serve, {'document_root': MEDIA_ROOT}), path('api-auth/', include('rest_framework.urls')) ]