import xadmin from users.views import LoginView, RegisterView, ActiveView, ForgetView, ResetView, ModifyPwdView from organization.views import OrgView from MxOnline.settings import MEDIA_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), # 将静态文件转换为view 不用自己写view函数 url('^$', TemplateView.as_view(template_name='index.html'), name='index'), url(r'^login/$', LoginView.as_view(), name='login'), url(r'^register/$', RegisterView.as_view(), name='register'), url(r'^captcha/', include('captcha.urls')), url(r'^active/(?P<active_code>.*)/$', ActiveView.as_view(), name='user_active'), url(r'^forget/$', ForgetView.as_view(), name='forget'), url(r'^reset/(?P<active_code>.*)/$', ResetView.as_view(), name='reset'), url(r'^modify/$', ModifyPwdView.as_view(), name='modify_pwd'), # 配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)/$', serve, {'document_root': MEDIA_ROOT}), # 导入org的urls文件 url(r'^org/', include('organization.urls', namespace='org')), # 导入course的urls文件 url(r'^course/', include('courses.urls', namespace='course')), ]
from organization.views import UserFavView urlpatterns = [ path('api-auth/', include('rest_framework.urls',)), path('admin/', xadmin.site.urls), #path('user/',include('api.urls')), #path('user/',include('app01.urls')), path('user/',include('usertest.urls',namespace='user')), path('',IndexView.as_view(),name='index'), path('login/',LoginView.as_view(),name='login'), path('logout/',userlogout,name='logout'), path('register/',RegisterView.as_view(),name='register'), path('forget/',ForgetView.as_view(),name='forget'), re_path('active/(\w+)/',ActiveUserView.as_view()), re_path('reset/(\w+)/',RestView.as_view()), #path('org_list/$',OrgView.as_view(),name='org_list'), re_path(r'^media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT }), re_path(r'org_list/(\d+)/$',OrgView.as_view(),name='org_list'), path('userask/',UserAskView.as_view(),name='userask'), #path('forumlink/',include('forumlink.urls',namespace='forumlink')), #两种方式的url,对应到view中的参数是不一样的。正则方式在view中需要通过参数的方式 #获取,有两种方式 #一:函数形式参数传递: #def get(request,id) #二:通过arg获取 arg【0】 #url中定义了参数id,view中必须对应到,具体参考代码示例。 #re_path('orghome/(\d+)/',OrgHomeView.as_view(),name='orghome'), path('orghome/<str:id>/', OrgHomeDetail.as_view(), name='orghome'),
from django.conf.urls import url from users.views import RegisterView, LoginView, InforView, ForgetView, PasswordView, SendMsg, MemberView, AddressView, \ GladdressView urlpatterns = [ url(r'^register/$', RegisterView.as_view(), name='注册'), url(r'^login/$', LoginView.as_view(), name='登录'), url(r'^infor/$', InforView.as_view(), name='个人资料'), url(r'^forgetpassword/$', ForgetView.as_view(), name='忘记密码'), url(r'^password/$', PasswordView.as_view(), name='修改密码'), url(r'^sendmsg/$', SendMsg.as_view(), name='发送短信验证'), url(r'^member/$', MemberView.as_view(), name='个人中心'), url(r'^address/$', AddressView.as_view(), name='收货地址'), url(r'^gladdress/$', GladdressView.as_view(), name='管理收货地址'), # url(r'^village/$', VillageView.as_view(), name='校区选择'), ]
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 django.views.generic import TemplateView from django.views.static import serve import xadmin from Teacher.settings import MEDIA_ROOT from users.views import LoginView, RegisterView, ActiveUserView, ForgetView, ResetView, ModifyPwdView ,LogoutView urlpatterns = [ url(r'^teacher/', xadmin.site.urls,name='teacher'), url('^$', TemplateView.as_view(template_name='index.html'), name='index'), url('^login/$', LoginView.as_view(), name='login'), url('^logout/$', LogoutView.as_view(), name="logout"), url('^register/$', RegisterView.as_view(), name='register'), url(r'^captcha/', include('captcha.urls')), url(r'activity/(?P<active_code>.*)/$', ActiveUserView.as_view(), name="user_active"), url(r'^forget', ForgetView.as_view(), name="forget_pwd"), url(r'^modify_pwd', ModifyPwdView.as_view(), name="modify_psw"), url(r'reset/(?P<active_code>.*)/$', ResetView.as_view(), name="user_active"), url(r'^media/(?P<path>.*)$', serve, {"document_root":MEDIA_ROOT}), url(r'^users/', include('users.urls',namespace="users")), url(r'^questions/', include('questions.urls',namespace="questions")), url(r'^exam/', include('exam.urls',namespace="exam")), url(r'^class/', include('classs.urls',namespace="class")), url(r'^operation/', include('operation.urls',namespace="operation")), ]
from django.conf.urls import url from users.views import UserInfoView, ForgetView, CommentListView, LoginLogView, FavMovieView urlpatterns = [ # 个人中心 url(r'^userinfo/$', UserInfoView.as_view(), name='userinfo'), # 修改密码 url('forget/pwd/', ForgetView.as_view(), name='forget_pwd'), # 评论记录 url(r'^comment/$', CommentListView.as_view(), name='comment'), # 登录日志 url(r'^log/$', LoginLogView.as_view(), name='login_log'), # 收藏电影 url(r'^fav_movie/$', FavMovieView.as_view(), name='fav_movie') ]