from django.conf.urls import url, include from django.views.decorators.csrf import csrf_exempt from django.views.static import serve from apps.users.views import LoginView, LogoutView, SendSmsView, DynamicLoginView, RegisterView from apps.operations.views import IndexView from xxOnline.settings import MEDIA_ROOT urlpatterns = [ # path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), path('', IndexView.as_view(), name="index"), path('login/', LoginView.as_view(), name="login"), # 这里name的值必须用双引号 path('d_login/', DynamicLoginView.as_view(), name="d_login"), path('register/', RegisterView.as_view(), name="register"), path('logout/', LogoutView.as_view(), name="logout"), url(r'^captcha/', include('captcha.urls')), url(r'^send_sms/', csrf_exempt(SendSmsView.as_view()), name="send_sms"), url(r'^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}), # url(r'^static/(?P<path>.*)$', serve, {'document_root': STATIC_ROOT}), url(r'^org/', include(('apps.organizations.urls', 'organizations'), namespace='org')), url(r'^op/', include(('apps.operations.urls', 'operations'), namespace='op')), url(r'^course/', include(('apps.courses.urls', 'courses'), namespace='course')), url(r'^users/', include(('apps.users.urls', 'users'), namespace='users')), url(r'^ueditor/', include('DjangoUeditor.urls')) ]
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 from django.conf.urls import url, include from django.views.generic import TemplateView from django.views.decorators.csrf import csrf_exempt import xadmin from apps.users.views import LoginView, SendSmsView, DynamicLoginView urlpatterns = [ url(r'^captcha/', include('captcha.urls')), # path('admin/', admin.site.urls), # 添加xadmin path('xadmin/', xadmin.site.urls), path('', TemplateView.as_view(template_name='index.html'), name='index'), path('login/', LoginView.as_view(), name='login'), path('d_login/', DynamicLoginView.as_view(), name='d_login'), path('send_sms/', csrf_exempt(SendSmsView.as_view()), name='send_sms'), ]
path('xadmin/', xadmin.site.urls), path('', IndexView.as_view(), name='index'), # 登录,退出,注册 path('login/', LoginView.as_view(), name='login'), path('logout/', LogoutView.as_view(), name='logout'), path('register/', RegisterView.as_view(), name='register'), # 手机验证码登录 path('d_login/', DynamicLoginView.as_view(), name='d_login'), # 图形码接口 url(r'^captcha/', include('captcha.urls')), # 校验图形验证码,验证成功后才发送手机验证码 # 这个借口封装在'发送验证码'的input标签下的ajax请求内,源代码在login.js中 url(r'^send_sms/', csrf_exempt(SendSmsView.as_view(), ), name='send_sms'), # 配置上传文件的访问url url(r'^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}), # 静态文件接口,当DEBUG=False时,才启用 # url(r'^static/(?P<path>.*)$', serve,{'document_root':STATIC_ROOT}), # 机构相关页面 # url(r'^org_list/', OrgView.as_view(), name='org_list'), url(r'^org/', include(('apps.organizations.urls', 'organizations'), namespace='org')), # 用户相关操作(收藏) url(r'^op/', include(('apps.operations.urls', 'operations'), namespace='op')),
from django.views.decorators.csrf import csrf_exempt from django.views.static import serve import xadmin from apps.users.views import LoginView, LogoutView, SendSmsView, DynamicLoginView, RegisterView from apps.organizations.views import OrgView from MxOnline.settings import MEDIA_ROOT urlpatterns = [ # path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), path('', TemplateView.as_view(template_name='index.html'), name='index'), path('login/', LoginView.as_view(), name='login'), path('d_login', DynamicLoginView.as_view(), name='d_login'), re_path('^logout/$', LogoutView.as_view(), name='logout'), url('^captcha/', include('captcha.urls')), re_path('^send_sms/$', csrf_exempt(SendSmsView.as_view()), name='send_sms'), re_path('^register/$', RegisterView.as_view(), name='register'), # media路由 re_path('^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}), # 机构相关页面 re_path( r'^org/', include(('apps.organizations.urls', 'organizations'), namespace='org')), ]
from django.urls import path from django.conf.urls import url from django.views.generic import View from django.views.generic import TemplateView from django.contrib.auth.decorators import login_required from apps.users.views import LoginView, LogoutView, SendSmsView, MobileLoginView, RegisterView, UserInfoView, \ UploadImageView, UploadInfoView, UpdatePwdView from apps.users.views import UpdateMobileView, MyFavOrgView, MyFavTeacherView, MyFavCourseView, UsersMessageView urlpatterns = [ path('login/', LoginView.as_view(), name='login'), path('logout/', LogoutView.as_view(), name='logout'), path('send_sms/', SendSmsView.as_view(), name='dend_sms'), path('mobilelogin', MobileLoginView.as_view(), name='mobilelogin'), path('register/', RegisterView.as_view(), name='register'), # 个人中心 url(r'^user_info$', UserInfoView.as_view(), name='user_info'), # 个人中心-个人资料 url(r'^upload_image$', UploadImageView.as_view(), name='upload_image'), # 个人中心-个人资料-修改头像 url(r'^upload_info$', UploadInfoView.as_view(), name='upload_info'), # 个人中心-个人资料修改 url(r'^update_pwd$', UpdatePwdView.as_view(), name='update_pwd'), # 个人中心-个人资料密码修改 url(r'^update_mobile$', UpdateMobileView.as_view(), name='update_mobile'), # 个人中心-个人资料手机号修改 # 我的课程 url(r'^mycourse$', login_required(