""" # 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 user_login from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyPwdView from organization.views import OrgView from mxonline3.settings import MEDIA_ROOT # import captcha urlpatterns = [ # path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), # TemplateView.as_view会将template转换为view path('', TemplateView.as_view(template_name='index.html'), name='index'), # path('login/', TemplateView.as_view(template_name='login.html'), name='login'), # path('login/', user_login, name='login'), path('login/', LoginView.as_view(), name='login'), path('register/', RegisterView.as_view(), name='register'), path('captcha/', include('captcha.urls')), path('active/<slug:active_code>', ActiveUserView.as_view(), name='active'), path('forget/', ForgetPwdView.as_view(), name='forget_pwd'), path('reset/<slug:active_code>', ResetView.as_view(), name='reset_pwd'), path('modify_pwd/', ModifyPwdView.as_view(), name='modify_pwd'), path('org_list/', OrgView.as_view(), name='org_list'), # 配置上传文件的处置函数 path('media/<path:path>', serve, {'document_root': MEDIA_ROOT}), ]
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 import xadmin from django.views.static import serve from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyPwdView from organization.views import OrgView from mxonline.settings import MEDIA_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url('^$', TemplateView.as_view(template_name='index.html'), name='index'), url('^login/$', LoginView.as_view(), name='login'), 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/$', ForgetPwdView.as_view(), name='forget_pwd'), url(r'^reset/(?P<active_code>.*)/$', ResetView.as_view(), name='reset_pwd'), url(r'^modifypwd/$', ModifyPwdView.as_view(), name='modify_pwd'), url(r'^org/', include('organization.urls', namespace='org')), url(r'^media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}), url(r'^course/', include('courses.urls', namespace='course')), url(r'^users/', include('users.urls', namespace='users')), ]
from django.views.generic import TemplateView from django.views.static import serve #static多用于处理静态文件 from MxOnline.settings import MEDIA_ROOT from users.views import LoginView , RegisterView ,ActiveUserView ,ForgetPwdView,ResetView,ModifyPwdView #自己定义的view login from organization.views import OrgView urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url(r'^$',TemplateView.as_view(template_name='index.html'),name='index'), #url(r'^login/$',user_login,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='user_active'), #正则,将active/之后所有字符串放在active_code中,P表示参数的意思 url(r'^forget/$', ForgetPwdView.as_view(), name='forgrt_pwd'), url(r'reset/(?P<reset_code>.*)/$',ResetView.as_view(),name='reset_pwd'), url(r'^modify_pwd/$', ModifyPwdView.as_view(), name="modify_pwd"), #课程机构url配置,详情在oragnization/urls中, # #在html中org:org_list的org表示namespace,后面是name url(r'^org/',include('organization.urls',namespace='org')), #配置上传文件的访问处理函数(课程图片上传) url(r'^media/(?P<path>.*)$',serve,{'document_root':MEDIA_ROOT}), url(r'^course/',include('courses.urls',namespace='course')), ]
from django.views.generic import TemplateView import xadmin from MapleMooc.settings import MEDIA_ROOT from users.views import LoginView, ForgetPwdView, ResetView, ModifyPwdView, RegisterView, ActiveUserView, IndexView, \ LogoutView, UserInfoView, UploadImageView, UpdatePwdView, MyCourseView, MyMessageView, MyFavoriteView app_name = 'user' urlpatterns = [ path('login/', LoginView.as_view(), name='login'), # 登录 path('logout/', LogoutView.as_view(), name='logout'), # 退出 path('register/', RegisterView.as_view(), name='register'), # 注册 path('forget/', ForgetPwdView.as_view(), name='forget_pwd'), path('reset/', ResetView.as_view(), name='reset_pwd'), path('modify_pwd/', ModifyPwdView.as_view(), name='modify_pwd'), path('info/', UserInfoView.as_view(), name='user_info'), # 上传用户头像 path('image/upload/', UploadImageView.as_view(), name='image_upload'), path('update/pwd/', UpdatePwdView.as_view(), name="update_pwd"), # 我的课程 path('my_course/', MyCourseView.as_view(), name='my_course'), # 我的收藏 path('my_favorite/', MyFavoriteView.as_view(), name='my_favorite'), path('my_favorite/<int:fav_type>', MyFavoriteView.as_view()), # 我的消息 path('my_message/', MyMessageView.as_view(), name='my_message'), path('xadmin/', xadmin.site.urls), path('active/<active_code>/', ActiveUserView.as_view(), name='user_active'), ]
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}), ]
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, re_path from django.views.generic import TemplateView from users.views import LoginView, RegisterView, ActiveUserView from organization.views import OrgView import xadmin from MxOnline.settings import MEDIA_ROOT from django.views.static import serve 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('register/', RegisterView.as_view(), name='register'), path('captcha/', include('captcha.urls')), path('active/<str:active_code>/', ActiveUserView.as_view()), re_path('^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}), # 机构urls path('org/', include('organization.urls', namespace='org')), # 课程urls path('course/', include('courses.urls', namespace='course')), #用户个人中心 path('users/', include('users.urls', namespace='users')) ]
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.conf.urls.static import static from .settings import MEDIA_ROOT, MEDIA_URL import xadmin from users.views import LoginView, RegisterView, ActiveUserView, ForgetPasswordView app_name = 'organization' urlpatterns = [ path('xadmin/', xadmin.site.urls), path('index/', TemplateView.as_view(template_name="index.html"), name="index"), path('login/', LoginView.as_view(), name="login"), path('logout/', TemplateView.as_view(template_name="login.html"), name="logout"), path('register/', RegisterView.as_view(), name="register"), path('captcha/', include('captcha.urls')), path('active/<int:active_code>', ActiveUserView.as_view(), name="active"), path('forgetpwd/', ForgetPasswordView.as_view(), name="forgetpwd"), # 授课机构url配置 path('org/', include('organization.urls', namespace='org')), ] # 配置上传文件的访问地址 urlpatterns += static(MEDIA_URL, document_root=MEDIA_ROOT)
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")), ]
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.static import static import xadmin from users.views import LoginView, RegisterView, ActiveUserView, LogoutView, IndexView from .settings import MEDIA_ROOT, MEDIA_URL urlpatterns = [ 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('send_success/', TemplateView.as_view(template_name="send_success.html"), name="send_success"), # 激活账号 re_path("active/(?P<token>.*)/", ActiveUserView.as_view(), name="user_active"), # 验证码 path("captcha/", include('captcha.urls')), # 富文本编辑器 path('ueditor/', include('DjangoUeditor.urls')), path('ckeditor/', include('ckeditor_uploader.urls')), # 课程相关 path("course/", include('courses.urls', namespace="course")), # 配置文件上传的url,serve到某个路径下去找 re_path(r'^media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}), path("users/", include('users.urls', namespace="users")), path('article/', include('article.urls', namespace='article')), path("search/", include('haystack.urls')), path("mdeditor/", include('mdeditor.urls')) ] + static(MEDIA_URL, document_root=MEDIA_ROOT) # 没有这一句无法显示上传的图片
from organization.views import OrgView # 函数方法 # from users import views urlpatterns = [ 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('login/', views.user_login, name='login'), path('captcha/', include('captcha.urls')), re_path('active/(?P<active_code>.*)/', ActiveUserView.as_view(), name='user_active'), path('forget/',ForgetPwdView.as_view(), name='forget_pwd'), re_path(r'reset/(?P<active_code>.*)/', ResetView.as_view(), name='reset_pwd'), path('modify_pwd/', ModifyPwdView.as_view(), name='modify_pwd'), # 个人信息 path("users/", include('users.urls', namespace="users")), # 课程 path("course/", include('course.urls', namespace="course")), # 机构 path("org/", include('organization.urls', namespace="org")), # path('org_list/', OrgView.as_view(), name='org_list'), # 处理图片显示的url,使用Django自带serve,传入参数告诉它去哪个路径找,我们有配置好的路径MEDIAROOT re_path(r'^media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}),
from django.views.generic import TemplateView from django.views.static import serve from users.views import LoginView, LogoutView, RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyPwdView from mxonline.settings import MEDIA_ROOT # , STATIC_ROOT from users.views import IndexView 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()), url(r'^forget/$', ForgetPwdView.as_view(), name='forget_pwd'), url(r'^reset/(?P<reset_code>.*)/$', ResetView.as_view(), name='reset'), url(r'^modify_pwd/$', ModifyPwdView.as_view(), name='modify_pwd'), url(r'^org/', include('organization.urls', namespace='org')), url(r'^course/', include('course.urls', namespace='course')), url(r'^user/', include('users.urls', namespace='user')), # 配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}), # 生产环境下配置静态文件的访问处理函数 # url(r'^static/(?P<path>.*)$', serve, {'document_root': STATIC_ROOT}), url(r'^ueditor/', include('DjangoUeditor.urls')), ]
from users.views import user_login, LoginView, RegisterView, ActiveUserView, ForgetPwdView, RestpwdView, ModifypwdView, LogoutView from organization.views import OrgListView from users.views import IndexView urlpatterns = [ path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), # path('', TemplateView.as_view(template_name='index.html'), name='index'), path('', IndexView.as_view(), name='index'), # path('login/', TemplateView.as_view(template_name='login.html'), name='login'), # path('login/', user_login, name='login'), path('login/', LoginView.as_view(), name='login'), # 基于类方法实现登录,这里是调用它的方法 path('logout/', LogoutView.as_view(), name='logout'), # 退出登录 path('register/', RegisterView.as_view(), name='register'), re_path('register/active/(?P<active_code>.*)/', ActiveUserView.as_view(), name='user_active'), # 激活 path('captcha/', include('captcha.urls')), path('forgetpwd/', ForgetPwdView.as_view(), name='forgetpwd'), # 忘记密码 re_path('forgetpwd/reset/(?P<active_code>.*)/', RestpwdView.as_view(), name='resetpwd'), # 密码重置验证 path('modify_pwd/', ModifypwdView.as_view(), name="modify_pwd"), # 密码修改 # path('org/list/', OrgListView.as_view(), name="org_list"), # 机构列表 # 课程机构url配置 path('org/', include('organization.urls', namespace='org')), # 课程相关功能url path('course/', include('courses.urls', namespace='course')), # 讲师 path('teacher/', include('organization.urls2', namespace='teacher')), # 用户中心 path('usercenter/', include('users.urls', namespace='usercenter')), ]
from users.views import LoginView,RegisterView,ActiveUserView,ForgetPwdView,ResetUserView,ModifyPwdView,LogOutView,IndexView from django.views.generic import TemplateView from django.views.static import serve import captcha from .settings import MEDIA_ROOT from organiation import urls as org_urls from courses import urls as course_urls from users import urls as user_urls urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), 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"^$",IndexView.as_view(),name='index'), url(r'^captcha/',include('captcha.urls')), 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_pwd/$',ModifyPwdView.as_view(),name='modify_pwd'), url(r'^forget/$',ForgetPwdView.as_view(),name="forget"), #课程机构url # url(r'^org_list/$',OrgView.as_view(),name='org_list'), url(r'^org/',include(org_urls,namespace='org')), #上传文件的访问处理函数 url(r'^media/(?P<path>.*)$',serve,{'document_root':MEDIA_ROOT}), # 生产模式服务器静态文件url # url(r'^static/(?P<path>.*)$',serve,{'document_root':STATIC_ROOT}), # 课程相关url url(r'^course/',include(course_urls,namespace='course')), # 教师相关url # url(r'^teacher/',include(course_urls,namespace='course')), # 用户相关url
from users.views import LoginView,RegisterView,ActiveUserView,ForgetPwdView,ResetUserView,ModifyPwdView,LogOutView from organization.views import OrgListView from users.views import IndexView from jyxt.settings import MEDIA_ROOT from django.views.static import serve 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'^forget_pwd/$', ForgetPwdView.as_view(),name="forget_pwd"), url(r'^modify_pwd/$', ModifyPwdView.as_view(),name="modify_pwd"), url(r'^active/(?P<active_code>.*)/$',ActiveUserView.as_view(),name="Active"), url(r'^reset/(?P<active_code>.*)/$',ResetUserView.as_view(),name="reset"), #机构页面 url(r'^org/', include('organization.urls',namespace="org")), #上传静态文件处理URl url(r'media/(?P<path>.*)/$',serve,{"document_root":MEDIA_ROOT}), #上传静态文件处理URl # url(r'static/(?P<path>.*)/$',serve,{"document_root":STATIC_ROOT}), #课程页面 url(r'^course/', include('course.urls',namespace="course")), #用户信息 url(r'^user/', include('users.urls',namespace="user_info")), ] handler404 = 'users.views.not_page_found' handler500 = 'users.views.server_error'
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 import xadmin from django.views.generic import TemplateView from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetView from organization.views import OrgList from django.views.static import serve from django_learn.settings import MEDIA_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), #url(r'^form/$', getform, name='UserMessageForm') url('^$', TemplateView.as_view(template_name='index.html'), name='index'), url('^login/$', LoginView.as_view(), name='login'), url('^register/$', RegisterView.as_view(), name='register'), url(r'^captcha/', include('captcha.urls')), url(r'^verifyCode/$', ActiveUserView.as_view(), name='verifyCode'), url(r'^forgetpwd/$', ForgetPwdView.as_view(), name='forgetpwd'), url(r'^pwdReset/$', ResetView.as_view(), name='pwdReset'), url(r'^org-list/$', OrgList.as_view(), name='org_list'), url(r'media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}) ]
import xadmin from django.views.generic import TemplateView from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyView from organization.views import OrgListView from django.views.static import serve from DjangoLearning.settings import MEDIA_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), # 使用template.as_view 就不需要自己写view.py 适合没有逻辑使用的html url('^$', TemplateView.as_view(template_name="index.html"), name="index"), url('^login/$', LoginView.as_view(), name="login"), url('^register/$', RegisterView.as_view(), name="register"), # 添加验证码 url('^captcha/', include('captcha.urls')), # 提取邮箱激活码 url('^active/(?P<activeCode>.*)/$', ActiveUserView.as_view(), name='active'), # 忘记密码 url('^forget/$', ForgetPwdView.as_view(), name='forget'), # 重置密码 url('^reset/(?P<activeCode>.*)/$', ResetView.as_view(), name='reset'), url('^modify/$', ModifyView.as_view(), name='modify_pwd'), url('^pwdResetSuccess/$', TemplateView.as_view(template_name="pwdResetSuccess.html"), name='pwdResetSuccess'), # 创建organization自己的urls url('^org/', include('organization.urls', namespace="org")), # 配置静态文件的路径(图片,gif) url('^media/(?P<path>.*)/$', serve, {"document_root": MEDIA_ROOT}), ]
from django.conf.urls import url, include from django.views.static import serve import xadmin from users.views import LoginView, LogoutView, RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyPwdView from users.views import IndexView from testonline.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'^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')), # 配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}), # 配置静态文件的访问处理函数 # url(r'^static/(?P<path>.*)$', serve, {"document_root": STATIC_ROOTS}),
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.views.generic import TemplateView from django.urls import path, include from users.views import user_login, user_logout, LoginView, RegisterView, ActiveUserView # from study.users.views import LoginView urlpatterns = [ path('admin/', admin.site.urls), path('', TemplateView.as_view(template_name='index.html'), name='index'), path('login/', LoginView.as_view(), name='login'), path('logout/', user_logout, name='logout'), path('register/', RegisterView.as_view(), name='register'), path('captcha/', include('captcha.urls')), path(r'^active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name='active'), ]
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.conf import settings from django.views.generic import TemplateView from django.views.static import serve from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetPwdView, \ ModifyPwdView from organization.views import CourseOrgView, Comments_Upload, CustomAddView, CustomAjaxView import xadmin urlpatterns = [ # url(r'^admin/', admin.site.urls), url(r'^admin/', xadmin.site.urls), url(r'^$', TemplateView.as_view(template_name='index.html'), name='my_index'), url(r'^login/$', LoginView.as_view(), name='my_login'), url(r'^register/$', RegisterView.as_view(), name='my_register'), url(r'^captcha/', include('captcha.urls')), url(r'^active/(?P<active_code>\w*)/$', ActiveUserView.as_view(), name='my_active_user'), url(r'^forget_pwd/$', ForgetPwdView.as_view(), name='forget_pwd'), url(r'^reset/(?P<reset_code>\w*)/$', ResetPwdView.as_view(), name='reset_pwd'), url(r'modify_pwd/$', ModifyPwdView.as_view(), name='my_modify_pwd'), url(r'^org_list/$', CourseOrgView.as_view(), name='org-list'), url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}), # 这个项目里面的测试,尝试用ajax动态的提交内容到后台 url(r'^comments_upload/$', Comments_Upload.as_view(), name='comments_upload'), url(r'^ajax/add/$', CustomAddView.as_view(), name='comments_add'), url(r'^ajax/$', CustomAjaxView.as_view(), name='ajax_add'), ]
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, re_path import xadmin from django.views.generic import TemplateView from django.conf.urls import url, include from django.views.static import serve from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyPwdView from online_edu.settings import MEDIA_ROOT urlpatterns = [ # 登录注册相关URL 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")), # 验证码 re_path('active/(?P<active_code>.*)/', ActiveUserView.as_view(), name='user_active'), # 注册用户激活 path('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(r'^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}) # 配置上传文件的访问处理函数 ]
from organization.views import OrgView from EduWeb.settings import MEDIA_ROOT, MEDIA_URL from django.conf.urls.static import static urlpatterns = [ # path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), # 调用TemplateView类的as_view方法,会自动转化一个view的函数过来,并在template_name参数指定文件即可,不用自己写一个view类 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="active"), path("forget/", ForgetPwdView.as_view(), name="forget_pwd"), # 密码重置链接 path("reset/<str:reset_code>/", ResetView.as_view(), name="reset_pwd"), path("modify_pwd/", ModifyPwdView.as_view(), name="modify_pwd"), # 课程机构url配置,以org开关的都会去organization.urls中找 path("org/", include('organization.urls', namespace="org")), # 课程相关url配置 path("course/", include('courses.urls', namespace="course")), # 讲师相关url配置 path("teacher/", include('organization.urls', namespace="teacher")), # 用户中心相关url配置 path("users/", include('users.urls', namespace="users")), # 富文本相关url path("ueditor/", include('DjangoUeditor.urls')),
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, include, re_path from django.views.generic import TemplateView from django.views.static import serve import xadmin from organization.views import OrgView from settings import MEDIA_ROOT from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, PswResetView, ModifyPwdView 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'), # 验证码url path('captcha/', include('captcha.urls')), re_path(r'^active/(?P<active_code>[a-zA-Z0-9]*)/$', ActiveUserView.as_view(), name='user_active'), path('forget/', ForgetPwdView.as_view(), name='forget_pwd'), re_path('reset/(?P<active_code>.*)/', PswResetView.as_view(), name="reset_pwd"), path('modify_pwd/', ModifyPwdView.as_view(), name="modify_pwd"), re_path(r'^media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}), # 课程机构app的url配置,讲师的也在里面 path('org/', include('organization.urls', namespace='org')), path('course/', include('courses.urls', namespace='course')), ]
import xadmin from apps.users import views from organization.views import OrgView from users.views import RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyPwdView from yunke.settings import STATIC_ROOT urlpatterns = [ path('xadmin/', xadmin.site.urls), path('',views.IndexView.as_view(),name='index'), # path('login/',TemplateView(template_name='login.html'),name='login'), path('login/',views.LoginView.as_view(),name='login'), #通过类的as_view()方法调用这个View类 path('register/',RegisterView.as_view()), path('captcha/',include('captcha.urls')), re_path('active/(?P<active_code>.*)/',ActiveUserView.as_view()), path('forget/',ForgetPwdView.as_view(),name='forget_pwd'), re_path('reset/(?P<active_code>.*)/',ResetView.as_view(),name='reset_pwd'), path('modify_pwd/',ModifyPwdView.as_view(),name='modify_pwd'), # path('org_list/',OrgView.as_view(),name='org_list'), path("org/", include('organization.urls', namespace="org")), path("course/",include('course.urls',namespace='course')), path("users/",include('users.urls',namespace='users')), re_path(r'^static/(?P<path>.*)',serve,{'document_root':STATIC_ROOT}), # 处理图片显示的url,使用Django自带serve,传入参数告诉它去哪个路径找,我们有配置好的路径MEDIAROOT re_path(r'^media/(?P<path>.*)',serve,{'document_root':MEDIA_ROOT}),
from django.conf.urls import url, include import xadmin from django.views.static import serve from MxOnline.settings import MEDIA_ROOT from users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetPwdView, ModifyPwdView, LogoutView, IndexView 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'^ueditor/', include('DjangoUeditor.urls')), url(r'^active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name='user_active'), url(r'^reset/(?P<active_code>.*)/$', ResetPwdView.as_view(), name='reset_pwd'), 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='organization')), # 课程的url配置 url(r'^course/', include('courses.urls', namespace='course')), # 用户信息的url配置 url(r'^user/', include('users.urls', namespace='user')), # 配置上传文件的访问路由 url(r'media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}),
from django.urls import path, include from django.views.static import serve from django.views.generic import TemplateView import xadmin from users.views import IndexView, LoginView, LogoutView, RegisterView, ActiveUserView, ForgetPwdView, ResetView from ithome.settings import MEDIA_ROOT urlpatterns = [ path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), path('captcha/', include('captcha.urls')), path('ueditor/', include('DjangoUeditor.urls')), path('', TemplateView.as_view(template_name="main_index.html"), name="index"), path('login/', LoginView.as_view(), name="login"), path('logout/', LogoutView.as_view(), name="logout"), path("register/", RegisterView.as_view(), name="register"), path('active/<active_code>/', ActiveUserView.as_view(), name="user_active"), path('forget/', ForgetPwdView.as_view(), name="forget_pwd"), path('reset/<active_code>/', ResetView.as_view(), name="reset_pwd"), path("users/", include("users.urls", namespace="users")), path("article/", include("article.urls", namespace="article")), path("activity/", include("activity.urls", namespace="activity")), path("query_assistant/", include("QueryAssistant.urls", namespace="QurtyAssistant")), path("resume/", include("resume.urls", namespace="resume")), path("media/<path:path>", serve, {"document_root": MEDIA_ROOT}), ]
path('', IndexView.as_view(), name= "index"), # 基于类方法实现登录,这里是调用它的方法 path('login/', LoginView.as_view(), name="login"), # 退出功能url path('logout/', LogoutView.as_view(), name="logout"), # 注册url path("register/", RegisterView.as_view(), name = "register" ), # 验证码url path("captcha/", include('captcha.urls')), # 激活用户url re_path('active/(?P<active_code>.*)/', ActiveUserView.as_view(), name= "user_active"), # 忘记密码 path('forget/', ForgetPwdView.as_view(), name= "forget_pwd"), # 重置密码urlc :用来接收来自邮箱的重置链接 re_path('reset/(?P<active_code>.*)/', ResetView.as_view(), name="reset_pwd"), # 修改密码url; 用于passwordreset页面提交表单 path('modify_pwd/', ModifyPwdView.as_view(), name="modify_pwd"), #驾驶舱 url(r'^dashboard/', include(router.urls)), # url(r'^dashboard/', include(dashing.urls)), # 知识分类app的url配置,类型的也在里面
URL configuration originally generated by "django-admin startproject" using Django 2.1.7 for the system; @author: Liu Haodong, Zhao Jichen, Ye Yifan, and Wang Annong ''' from . import views; import xadmin from django.urls import path, include, re_path from django.views.static import serve from PRS.settings import MEDIA_ROOT from users.views import LoginView, ActiveUserView, RegisterView, ForgetPwdView, ResetView, ModifyPwdView, LogoutView # the "urlpatterns" list routes URLs to views urlpatterns = [ path('me/', xadmin.site.urls), # Xadmin path('', views.home, name = 'index'), # the home page path('home/', views.home, name = 'home'), # the home page path('reg/', views.reg, name = 'reg'), # the registration page path('reg/data_refresh/', views.data_refresh, name = 'data_refresh'), # the registration page with real-time updated data path('reg/rec_reg/', views.rec_reg, name = 'rec_reg'), # the registration result page path('about/', views.about, name = 'about'), # the system introduction page path('login/', LoginView.as_view(), name = 'login'), # the login page path('sign-up/', RegisterView.as_view(), name = 'sign-up'), # the sigh-up page re_path(r'^media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}), # the media resource management url path('captcha/', include('captcha.urls')), # the captcha resource management url re_path('active/(?P<active_code>.*)/', ActiveUserView.as_view(), name = 'user_active'), # the page showing after activating successfully path('forget/', ForgetPwdView.as_view(), name = 'forget_pwd'), # the page for asking for resetting the password re_path('reset/(?P<active_code>.*)/', ResetView.as_view(), name = 'reset_pwd'), # the page for resetting the password path('modify_pwd/', ModifyPwdView.as_view(), name = 'modify_pwd'), # the page for modifying the password path('logout/', LogoutView.as_view(), name = "logout"), # the logout page ]