from users.views import ImageCodeView from users.views import SmsCodeView from users.views import LoginView from users.views import ForgetPasswordView from users.views import LogoutView from users.views import UserCenterView from users.views import WriteBlogView urlpatterns = [ #path的第一个参数是;路由 #第二个参数是视图函数名 path('register/', RegisterView.as_view(), name='register'), # path('register/',RegisterView.as_view(),name='register'), #图片验证码路由 #首页联系管理订阅订阅随笔- 53 文章- 0 评论- 7 # django基类View.as_view() path('imagecode/', ImageCodeView.as_view(), name='imagecode'), #短信验证码 path('smscode/', SmsCodeView.as_view(), name='smscode'), #登录路由 path('login/', LoginView.as_view(), name='login'), #忘记密码路由 path('forgetpassword/', ForgetPasswordView.as_view(), name='forgetpassword'), path('logout/', LogoutView.as_view(), name='logout'), path('center/', UserCenterView.as_view(), name='center'), #写博客路由 path('writeblog', WriteBlogView.as_view(), name="writeblog") ]
from django.conf.urls import url from users.views import RegisterView, ImageCodeView from users.views import SmsCodeView, LoginView from users.views import LogoutView, ForgetPasswordView from users.views import UserCenterView, WriteBlogView urlpatterns = [ # 参数1:路由 # 参数2:视图函数 # 参数3:路由名,方便通过reverse来获取路由 url(r'^register/', RegisterView.as_view(), name='register'), url(r'^imagecode/', ImageCodeView.as_view(), name='imagecode'), url(r'^smscode/', SmsCodeView.as_view(), name='smscode'), url(r'^login/', LoginView.as_view(), name='login'), url(r'^logout/', LogoutView.as_view(), name='logout'), url(r'^forgetpassword/', ForgetPasswordView.as_view(), name='forgetpassword'), url(r'^center/', UserCenterView.as_view(), name='center'), url(r'^writeblog/', WriteBlogView.as_view(), name='writeblog'), ]
from django.urls import path from users.views import RegisterBht from users.views import LoginBht from users.views import ImageCodeView from users.views import SmsCodeView from users.views import LogoutView from users.views import ForgetPasswordView from users.views import UserCenterView from users.views import WriteBlogView urlpatterns = [ # 参数1:路由 # 参数2:视图函数 # 参数3:方便通过reverse来获取路由 path("register/", RegisterBht.as_view(), name='register'), # 登陆路由 path('login/', LoginBht.as_view(), name='login'), # 退出登录 path('logout/', LogoutView.as_view(), name='logout'), # 忘记密码 path('forgetpassword/', ForgetPasswordView.as_view(), name='forgetpassword'), # 图片验证码路由 path('imagecode/', ImageCodeView.as_view()), # 短信发送 path('smscode/', SmsCodeView.as_view()), # 用户中心 path('center/', UserCenterView.as_view(), name='center'), #写博客 path('writeblog/', WriteBlogView.as_view(), name='writeblog'), ]
# 进行users 子应用的视图路由 from django.urls import path from users.views import RegisterView, ImageCodeView, SmsCodeView, LoginView, LogoutView, ForgetPasswordView, UserCenterView, WriteBlogView, SelfBlogView urlpatterns = [ # path第一个参数:路由 # path第二个参数:视图函数名 path('register/', RegisterView.as_view(), name='register'), # 图片验证码路由 path('imagecode/', ImageCodeView.as_view(), name='imagecode'), # 短信发送路由 path('smscode/', SmsCodeView.as_view(), name='smscode'), # 登录路由 path('login/', LoginView.as_view(), name='login'), # 登出路由 path('logout/', LogoutView.as_view(), name='logout'), # 忘记密码路由 path('forget_password/', ForgetPasswordView.as_view(), name='forgetpassword'), # 用户中心路由 path('center/', UserCenterView.as_view(), name='center'), # 写博客路由 path('write_blog/', WriteBlogView.as_view(), name='writeblog'), # 个人博客路由 path('self_blog/', SelfBlogView.as_view(), name='selfblog') ]
from django.urls import path from users.views import RegisterView, ImageCodeView, SmsCodeView, LoginView from users.views import LogoutView, ForgetPasswordView, UserCenterView, WriteBlogView urlpatterns = [ # 参数1:路由 # 参数2:视图函数 # 参数3:路由名,方便通过reverse来获取路由 path("register/", RegisterView.as_view(), name="register"), path("imagecode/", ImageCodeView.as_view(), name="imagecode"), path("smscode/", SmsCodeView.as_view(), name="smscode"), path("login/", LoginView.as_view(), name="login"), path("logout/", LogoutView.as_view(), name="logout"), path("forgetpassword/", ForgetPasswordView.as_view(), name="forgetpassword"), path("center/", UserCenterView.as_view(), name="center"), path("writeblog/", WriteBlogView.as_view(), name="writeblog"), ]
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')) ]