from django.urls import path,re_path from user.views import IndexView,LoginView,RegisterView,LogoutView,ActiveView app_name='[user]' urlpatterns = [ re_path(r'^index/(?P<page>\d+)*$',IndexView.as_view(),name='index'), re_path(r'^login$',LoginView.as_view(),name='login'), re_path(r'^register$',RegisterView.as_view(),name='register'), re_path(r'^logout$',LogoutView.as_view(),name='logout'), re_path(r'active/(?P<token>.*)',ActiveView.as_view(),name='active') ]
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url,include from django.contrib import admin from user.views import IndexView from django.views.static import serve from . import settings urlpatterns = [ url(r'^admin/', admin.site.urls), #首页路由必须'^$',不然都匹配错误 url(r'^$',IndexView.as_view(),name='index'), url(r'^user/',include('user.urls',namespace='user')), url(r'^project/', include('project.urls', namespace='project')), url(r'^startpro/', include('startpro.urls', namespace='startpro')), url(r'^order/', include('order.urls', namespace='order')), #静态文件路径,只需要在主应用的路由中配置就可以 url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}) ]
from django.conf.urls import url, include from django.contrib import admin from django.views.generic import TemplateView # 静态文件 from django.contrib.staticfiles.urls import static import xadmin, captcha from user.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, \ ResetView, ModifyPwdView, LogoutView, IndexView from organization.views import OrgView from django.views.static import serve from StudyOnline.settings import MEDIA_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url(r'^$', IndexView.as_view(), name="index"), url(r'^login/$', LoginView.as_view(), name="login"), url(r'^logout/$', LogoutView.as_view(), name="logout"), url(r'^register/$', RegisterView.as_view(), name="register"), url(r'^captcha/', include('captcha.urls')), url(r'^active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name="user_active"), url(r'^forget/$', ForgetPwdView.as_view(), name="forget_pwd"), url(r'^reset/(?P<active_code>.*)/$', ResetView.as_view(), name="reset_pwd"), url(r'^modify_pwd/$', ModifyPwdView.as_view(), name="modify_pwd"), # 课程机构url配置 url(r'^org/', include('organization.urls', namespace='org')), # 课程相关url配置 url(r'^course/', include('courses.urls', namespace='course')),
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ # from django.contrib import admin from django.urls import path, include from django.views.generic import TemplateView import xadmin from user.views import LoginView, IndexView, ConsumeRecordView, BorrowInfoView, RechargeView, SettingView, PayCodeView from user.views import UpdatePasswordView, PaymentSetView, PayAuthSetView, TicketView, logout urlpatterns = [ path('admin/', xadmin.site.urls), path('index/', IndexView.as_view(), name='index'), path('login/', LoginView.as_view(), name='login'), path('consume_record/', ConsumeRecordView.as_view(), name='consume_record'), path('borrow_info/', BorrowInfoView.as_view(), name='borrow_info'), path('recharge/', RechargeView.as_view(), name='recharge'), path('setting/', SettingView.as_view(), name='setting'), path('paycode/', PayCodeView.as_view(), name='paycode'), path('update_password/', UpdatePasswordView.as_view(), name='update_password'), path('payment_set/', PaymentSetView.as_view(), name='payment_set'), path('pay_auth_set/', PayAuthSetView.as_view(), name='pay_auth_set'), path('ticket/', TicketView.as_view(), name='ticket'), path('logout/', logout, name='logout'), path('operation/', include('operation.urls'))
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.urls import path, re_path, include from django.views.static import serve from Sun.settings import MEDIA_ROOT from user.views import IndexView, UserArticleCategoryView, LoginView, RegisterView, ForgetView, ActiveUserView, ResetUserView, ModifyPwdView, RefreshCaptchaView import xadmin urlpatterns = [ path('xadmin/', xadmin.site.urls), re_path('media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT }), path('', IndexView.as_view(), name="index"), # 基于类方法实现登录,这里是调用它的方法 path('login/', LoginView.as_view(), name="login"), # 基于类方法实现注册,这里是调用它的方法 path('register/', RegisterView.as_view(), name="register"), # 基于类方法实现找回密码,这里是调用它的方法 path('forget/', ForgetView.as_view(), name="forget"), # 验证码 path("captcha/", include('captcha.urls')), # 刷新验证码 path("getCaptcha/", RefreshCaptchaView.as_view(), name="refresh_captcha"), # 激活注册链接 re_path('active/(?P<active_code>.*)', ActiveUserView.as_view(), name="user_active"), re_path('reset/(?P<active_code>.*)', ResetUserView.as_view(), name="user_reset"), path('modifypwd/', ModifyPwdView.as_view(), name='modifypwd'), path('selectArticleCategory/', UserArticleCategoryView.as_view(), name='user_article_category'),
""" this is user router """ from django.conf.urls import url from user.views import RegisterView, Loginview, Cententview, Addressview, Infoview, Logoutview, SendCodeView, IndexView, \ MessageView, ShopcartView, AllorderView, DetailView, CategoryView urlpatterns = [ url(r'^register/$', RegisterView.as_view(), name='register'), # 注册 url(r'^user/$', Loginview.as_view(), name='login'), # 登录 url(r'^centent/$', Cententview.as_view(), name='centent'), # 个人中心 # url(r'^headimg/$', headIMG, name='headimg'), # 个人中心用户头像上传 url(r'^address/$', Addressview.as_view(), name='addressview'), # 收货地址 url(r'^info/$', Infoview.as_view(), name='info'), # 个人信息 url(r'^logout/$', Logoutview.as_view(), name='logout'), # 安全退出登录 url(r'^sendcode/$', SendCodeView.as_view(), name='SendCodeView'), # 发短信验证码 url(r'^$', IndexView.as_view(), name='IndexView'), # 显示index url(r'^message/$', MessageView.as_view(), name='MessageView'), # 动态 url(r'^shopcart/$', ShopcartView.as_view(), name='ShopcartView'), # 购物车 url(r'^allorder/$', AllorderView.as_view(), name='AllorderView'), # 订单 # url(r'^detail/(?P<id>\d+)/$', DetailView.as_view(), name='DetailView'), # 详情 url(r'^detail/$', DetailView.as_view(), name='DetailView'), # 详情 url(r'^category/$', CategoryView.as_view(), name='CategoryView'), # 列表 ]
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, re_path from django.conf.urls import url, include from django.views.generic.base import TemplateView from user import views as v from user.views import IndexView from moviedata import views as m from moviedata.views import detailView, detailbyIDView, RecommendView urlpatterns = [ path(r'admin/', admin.site.urls), path(r'accounts/', include('user.url')), path(r'accounts/', include('django.contrib.auth.urls')), re_path(r'^$', IndexView.as_view(), name=''), re_path( r'^search/$', TemplateView.as_view(template_name='search.html'), ), re_path(r'^search/query$', v.search_detail), re_path(r'db$', v.search), re_path(r'rating/', v.rating), re_path(r'del/', v.deleteRating), re_path(r'^profile/$', m.getprofile), re_path(r'^profile/detail$', v.getprofiledetail), re_path(r'^profile/post/', v.updateprofile), re_path(r'^moviedetail/search$', detailView.as_view(), name=''), re_path(r'^moviedetail/searchbyid$', detailbyIDView.as_view(), name=''), re_path(r'^recommend/$', RecommendView.as_view(), name=''), re_path(r'^recommends/userbased/$', m.recom),