from django.views.generic import TemplateView from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ModifyPwdView, ResetUserView, LogoutView from organization.views import OrgView from bs.settings import MEDIA_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), # url(r'^captcha/', include('captcha.urls')), url(r'^$', 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'^active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name="active"), url(r'^forgetpwd/$', ForgetPwdView.as_view(), name="forgetpwd"), url(r'^reset/(?P<active_code>.*)/$', ResetUserView.as_view(), name="reset"), url(r'^modify/$', ModifyPwdView.as_view(), name="modifypwd"), url(r'^logout/$', LogoutView.as_view(), name="logout"), #课程机构地址配置 url(r'^org/', include('organization.urls', namespace="org")), # 课程相关地址配置 url(r'^course/', include('courses.urls', namespace="course")), #配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}, name="media"), ]
from users.views import LoginView, LogoutView, IndexView, RegisterView, ActiveUserView, ForgetPwdView, ResetUserView, ModifyPwdView from HYSFOnline.settings import MEDIA_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url('^$', IndexView.as_view(), 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'^active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name='user_active'), url(r'^reset/(?P<active_code>.*)/$', ResetUserView.as_view(), name='user_reset'), url(r'^forget/$', ForgetPwdView.as_view(), name='forget_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')), #配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)/$', serve, {'document_root': MEDIA_ROOT}), # 配置静态文件的访问处理函数 # url(r'^static/(?P<path>.*)/$', serve, {'document_root': STATIC_ROOT}), # 用户相关url配置 url(r'^users/', include('users.urls', namespace='users')), # 富文本相关url url(r'^ueditor/', include('DjangoUeditor.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.contrib import admin from django.urls import path, include from django.views.generic import TemplateView from django.views.static import serve import xadmin from users.views import LoginView, RegisterView, ActiveUserView, LogoutView, ForgetPwdView, ResetUserView from .settings import MEDIA_ROOT urlpatterns = [ path('xadmin/', xadmin.site.urls), path('', TemplateView.as_view(template_name='index.html'), name='index'), path('login/', LoginView.as_view(), name='login'), path('register/', RegisterView.as_view(), name='register'), path('captcha/', include('captcha.urls')), path('active/<active_code>', ActiveUserView.as_view(), name='user_active'), path('logout/', LogoutView.as_view(), name='logout'), path('forget/', ForgetPwdView.as_view(), name='forget_pwd'), path('reset/<reset_code>', ResetUserView.as_view(), name='reset_pwd'), path('reset/', ResetUserView.as_view(), name='modify_pwd'), path('org/', include('organization.urls', namespace='org')), path('media/<path:path>', serve, {'document_root': MEDIA_ROOT}), ]
Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 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 users.views import IndexView, LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetUserView import xadmin urlpatterns = [ path('admin/', xadmin.site.urls), path('', IndexView.as_view(), name='index'), path('login/', LoginView.as_view(), name='login'), path('register/', RegisterView.as_view(), name='register'), path('captcha/', include('captcha.urls')), path('active/<str:active_code>/', ActiveUserView.as_view(), name='user_active'), # re_path('active/(?P<active_code>.*)/', ActiveUserView.as_view(), name='user_active'), path('forget/', ForgetPwdView.as_view(), name='forget_pwd'), path('reset/<str:reset_code>/', ResetUserView.as_view(), name='user_reset'), ]
from organization.views import OrgView from django.views.generic import TemplateView from django.views.static import serve from MXonline.settings import MEDIA_ROOT import xadmin 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>.*)/$',ResetUserView.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')), #个人中心相关URL配置 url(r'^users/',include('users.urls',namespace='users')), #富文本相关URL配置 url(r'^ueditor/',include('DjangoUeditor.urls')), #配置静态文件的访问处理函数
from django.views.static import serve from .settings import MEDIA_ROOT from organization.views import OrgView import xadmin urlpatterns = [ #path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), path('', TemplateView.as_view(template_name="index.html"), name="index"), #path('login/', TemplateView.as_view(template_name="login.html"), name="登录页面"), path('login/', LoginView.as_view(), name="登录页面"), path('register/', RegisterView.as_view(), name="注册页面"), #path('users/', include('users.urls')), #path('login/', LoginView.as_view(template_name="login.html"), name="login"), re_path('media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}), url('captcha/', include('captcha.urls')), #用来验证邮件激活的url链接 url('active/(?P<active_code>.*)', ActiveUserView.as_view(), name="user_active"), path('forget/', ForgetPwdView.as_view(), name="忘记密码"), url('reset/(?P<active_code>.*)', ResetUserView.as_view(), name="reset_pwd"), path('miodify_pwd/', ModifyPwdView.as_view(), name="modify_pwd"), #课程机构首页 path('org_list/', OrgView.as_view(), name="org_list"), ]
""" from django.urls import path, include, re_path import xadmin from MxOnline.settings import MEDIA_ROOT from django.views.generic import TemplateView from organizations.views import OrgView from users.views import ActiveUserView, ResetUserView, ModifyPwdView, LoginView, Registeriew, ForgetPwView from django.views.static import serve urlpatterns = [ path('xadmin/', xadmin.site.urls), path('', TemplateView.as_view(template_name="index.html"), name="index"), # path('login/', views.user_login, name="login"), path('login/', LoginView.as_view(), name="login"), path('register/', Registeriew.as_view(), name="register"), path('captcha/', include('captcha.urls')), re_path('active/(?P<active_code>.*)', ActiveUserView.as_view(), name="active"), # 括号提取active后面的字符串 path('forget/', ForgetPwView.as_view(), name="forget"), re_path('reset/(?P<reset_code>.*)', ResetUserView.as_view(), name="reset"), # 括号提取active后面的字符串 re_path('modify_pwd/', ModifyPwdView.as_view(), name="modify_pwd"), # 括号提取active后面的字符串 # 课程机构列表 path('org/', include("organizations.urls", namespace="org")), # 读取图片静态文件专用的path re_path('media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}) ]
from django.conf.urls import url, include from django.contrib import admin from django.views.generic import TemplateView import xadmin from django.views.static import serve from users.views import LoginView, RegisterView, ActiveUserView, ForgetView, ResetUserView, ModifyPwdView from organization.views import OrgView from MxOnline.settings import MEDIA_ROOT urlpatterns = [ url(r'^admin/', xadmin.site.urls), url(r'^$', 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>.*)/$', ActiveUserView.as_view(), name="user_active"), url(r'^forget/$', ForgetView.as_view(), name="forget_pwd"), url(r'^reset/(?P<reset_code>.*)/$', ResetUserView.as_view(), name="reset_pwd"), url(r'^modify_pwd/$', ModifyPwdView.as_view(), name="modify_pwd"), # 课程机构列表页urls配置 url(r'^org/', include('organization.urls', namespace="org")), # 课程相关页urls配置 url(r'^course/', include('courses.urls', namespace="course")), # 配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}) # url(r'^login/$', TemplateView.as_view(template_name='login.html'), name="login"), ]
from django.views.static import serve from django.conf import settings from users.views import LoginView, LogoutView, RegisterView, ActiveUserView, ForgetPwdView, ResetUserView, ModifyPwdView from .views import index import xadmin urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url(r'^captcha/', include('captcha.urls')), url('^$', index, name="index"), # url('^$', TemplateView.as_view(template_name="index.html"), 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'^active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name='active'), url(r'^reset/(?P<reset_code>.*)/$', ResetUserView.as_view(), name='reset'), url(r'^modify/$', ModifyPwdView.as_view(), name='modify_pwd'), url(r'^forget/$', ForgetPwdView.as_view(), name='forget'), # 课程机构首页 url(r'^org/', include('organization.urls', namespace="org")), # 课程列表首页 url(r'^courses/', include('courses.urls', namespace="courses")), # 配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)$', serve, {"document_root": settings.MEDIA_ROOT}), ]
from django.urls import re_path, include from users.views import LoginView, LogoutView, ActiveUserView, RegisterView, ForgetPasswordView, ResetUserView, UserCenterView, UploadImageView, UpdatePasswordView, EmailPinView, UpdateEmailView, MyCourseView, MyFavoriteCourseView, MyFavoriteTeacherView, MyFavoriteOrganizationView, MyMessageView urlpatterns = [ re_path(r'^login/$', LoginView.as_view(), name="login"), re_path(r'^logout/$', LogoutView.as_view(), name="logout"), re_path(r'^register/$', RegisterView.as_view(), name="register"), re_path(r'^captcha/', include('captcha.urls')), re_path(r'^active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name="user_active"), re_path(r'^forget/$', ForgetPasswordView.as_view(), name="forget_password"), re_path(r'^reset/(?P<reset_code>.*)/$', ResetUserView.as_view(), name="reset_user"), re_path(r'^reset/$', ResetUserView.as_view(), name="reset_user"), re_path(r'^usercenter/$', UserCenterView.as_view(), name="usercenter"), re_path(r'^usercenter/image/upload/$', UploadImageView.as_view(), name="upload_image"), re_path(r'^usercenter/password/update/$', UpdatePasswordView.as_view(), name="update_password"), re_path(r'^usercenter/email_pin/send/$', EmailPinView.as_view(), name="email_pin"), re_path(r'^usercenter/email/update/$', UpdateEmailView.as_view(), name="update_email"),
from model import xadmin from django.views.static import serve from organization.views import Org from users.views import LogingView, RegisterView, ActiveUserView, ForgetPwdView, ResetUserView, Modify, LogoutsView, \ IndexView, LoginUnsafeView from xadminDjango import settings urlpatterns = [ path('xadmin/', xadmin.site.urls), path('', IndexView.as_view()), path('login/', LogingView.as_view()), path('logout/', LogoutsView.as_view()), path('register/', RegisterView.as_view()), path('captcha/', include('captcha.urls')), re_path(r'^active/(?P<active_code>.*)/$', ActiveUserView.as_view()), path('forget/', ForgetPwdView.as_view(), name='forge'), re_path(r'^reset/(?P<active_code>.*)/$', ResetUserView.as_view()), re_path(r'^modify/$', Modify.as_view()), re_path(r'^org/', include('organization.urls')), re_path(r'^course/', include('courses.urls')), re_path(r'^user/', include('users.urls')), re_path(r'^ueditor/', include('DjangoUeditor.urls')), re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}), #配置文件上传html显示 #re_path(r'^static/(?P<path>.*)$', serve, {'document_root':settings.STATI_ROOT})#配置文件上传html显示 ] #全局404 handler404 = 'users.views.page_not_found' handler500 = 'users.views.page_error'