from users.views import MyTokenObtainPairView, CurrentUsersDetailView, CreateBasicUserView, \ UsersDetailView, ActivateUserView, RequestResetPasswordView, \ ResetPasswordView, ChangePasswordView app_name = 'users' urlpatterns = [ path('', UsersDetailView.as_view(), name='list_all_users_details'), path('token/', MyTokenObtainPairView.as_view(), name='token_obtain_pair'), path('token/refresh/', jwt_views.TokenRefreshView.as_view(), name='token_refresh'), path('token/verify/', jwt_views.TokenVerifyView.as_view(), name='token_verify'), path('current/', CurrentUsersDetailView.as_view(), name='current_user_detail'), path('create-basic/', CreateBasicUserView.as_view(), name='create_basic_user'), path('activate/', ActivateUserView.as_view(), name='activate_user'), path("request-password-reset/", RequestResetPasswordView.as_view(), name="request_password_reset"), path("reset-password/", ResetPasswordView.as_view(), name="reset_password"), path("change-password/", ChangePasswordView.as_view(), name="change_password"), ]
1. Add an import: from my_app import views 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 django.views.generic import TemplateView from users.views import LoginView, RegisterView, ActiveUserView, ForgetpwdView, ResetPasswordView, Multiply import xadmin urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url(r'^$', TemplateView.as_view(template_name="index.html"), name="index"), #url(r'^login/$',TemplateView.as_view(template_name="login.html"),name="login") 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>.*)/$', ActiveUserView.as_view(), name="active_user"), url(r'^forgetpwd/$', ForgetpwdView.as_view(), name="forgetpwd"), url(r'^reset/(?P<code>.*)/$', ResetPasswordView.as_view(), name="reset"), url(r'^test/(?P<x>.*)/(?P<y>.*)/$', Multiply.as_view(), name="multiply"), ]
3. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) """ from django.conf.urls import url, include from django.views.static import serve from django.views.generic import TemplateView import xadmin from users.views import LoginView, RegisterView, UserActivateView, ForgetPwdView, ResetPasswordView, Modify_pwdView from organization.views import TestView from .settings import MEDIA_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url('^$', TemplateView.as_view(template_name='index.html'), name='index'), # url('^login/$', user_login,name ='login'), url('^login/$', LoginView.as_view(), name='login'), url('^register/$', RegisterView.as_view(), name='register'), url(r'^captcha/', include('captcha.urls')), url(r'^active/(?P<activate_code>.*)/$', UserActivateView.as_view(), name='active'), url(r'^forget/$', ForgetPwdView.as_view(), name='forget'), url(r'^reset/(?P<activate_code>.*)/$', ResetPasswordView.as_view(), name='reset'), url(r'^modify/$', Modify_pwdView.as_view(), name='modify'), url(r'^ora/', include('organization.urls', namespace='org')), # 配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}) ]
from users.views import LoginView, RegisterView, ActiveUserView, ForgetView, ResetPasswordView, ModifyPasswordView, LogoutView, IndexView, LoginUnsafeView from Mxonline.settings import MEDIA_ROOT import xadmin urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url('^$', IndexView.as_view(), name="index"), # url('^login/$', LoginView.as_view(), name="login"), url('^login/$', LoginUnsafeView.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'^active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name="user_active"), url(r'^forget/$', ForgetView.as_view(), name="forget_pwd"), url(r'^reset/(?P<active_code>.*)/$', ResetPasswordView.as_view(), name="reset_pwd"), url(r'^modify_pwd/$', ModifyPasswordView.as_view(), name="modify_pwd"), # 课程机构url配置 url(r'^org/', include('organization.urls', namespace="org")), # 课程相关url配置 url(r'^course/', include('courses.urls', namespace="course")), # 配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}), # 配置static文件的访问处理函数 # url(r'^static/(?P<path>.*)', serve, {"document_root": STATIC_ROOT}), # 用户相关url配置
from django.views.static import serve from django.views.generic.base import RedirectView from users.views import LoginView, RegisterView, ActiveView, UpdatePasswordView, ResetPasswordView from courseonline.settings import MEDIA_ROOT from core.views import LogoutView, IndexView urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), url(r'^index.html$', IndexView.as_view(), name='index_html'), url(r'^login.html$', LoginView.as_view(), name='login'), url(r'^logout$', LogoutView.as_view(), name='logout'), url(r'^register.html$', RegisterView.as_view(), name='register'), url(r'^active', ActiveView.as_view(), name='active'), url(r'^password/110$', UpdatePasswordView.as_view(), name='find_password'), url(r'^password/find', ResetPasswordView.as_view(), name='reset_password'), url(r'^favicon\.ico$', RedirectView.as_view(url='/static/img/favicon.ico')), url(r'^teacher/', include('operation.urls', namespace='teacher'), name='teacher'), url(r'^org/', include('orgzation.urls', namespace='org'), name='orglist'), url(r'^course/', include('courses.urls', namespace='course'), name='course'), url(r'^search/', include('core.urls', namespace='search'), name='core'), url(r'^user/', include('users.urls', namespace='user'), name='user'), url(r'^test/', include('tests.urls', namespace='test'), name='test'), # 后台管理 url(r'^xadmin/', xadmin.site.urls), # 处理静态文件 # url(r'^static/(?P<path>.*)', serve, {"document_root": STATIC_ROOT}), # 在DEBUG为False时,且没有使用Apache/Nginx部署时,需要django处理静态文件的传输 url(r'^media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}), # 验证码插件
path('questionnaire/', QuestionnaireView.as_view(), name='questionnaire'), path('questionnaire-step1/', questionnaire_step1, name='questionnaire-step1'), path('questionnaire-steps/', SaveQuestionnaireStepView.as_view(), name='save-questionnaire'), path('login/', user_login, name='login'), path('logout/', user_logout, name='logout'), path('register/', register, name='register'), path('register-verify/', RegisterVerifyView.as_view(), name='register_verify'), path('password/', FirstChangePassword.as_view(), name='set_password'), path('sms/<str:phone>/', sms.sms, name='sms'), path('reset/', ResetPasswordView.as_view(), name="reset-password"), path('reset-verify/', ResetPasswordVerifyView.as_view(), name='reset-password-verify'), path('reset-confirm/', ResetPasswordConfirmView.as_view(), name='reset-password-confirm'), path('my/', login_required(profile), name='profile'), path('my/<str:active>/', login_required(profile), name='profile'), path('my/<str:active>/<str:page>/', login_required(profile), name='profile'), path('change_email/', login_required(sms.change_email), name='change_email'), re_path(