#!/usr/bin/env python # -*- coding: utf-8 -*- # 开发人员 :Davis Niu # 开发时间 :9/2/2020 8:20 AM # 文件名称 :urls.py from django.urls import re_path from apps.organizations.views import OrgView, AddAskView, OrgHomeView, OrgTeacherView urlpatterns = [ re_path(r'^list/$', OrgView.as_view(), name='list'), re_path(r'^add_ask/$', AddAskView.as_view(), name='add_ask'), re_path(r'^(?P<org_id>\d+)/$', OrgHomeView.as_view(), name='home'), re_path(r'^(?P<org_id>\d+)/teacher/$', OrgTeacherView.as_view(), name='teacher'), ]
from django.conf.urls import url from apps.organizations.views import OrgView, AddAsk urlpatterns = [ url(r'^list/$', OrgView.as_view(), name='list'), url(r'^add_ask/$', AddAsk.as_view(), name='add_ask'), ]
from django.conf.urls import url from apps.organizations.views import OrgView,AddAskView,OrgHomeView,OrgTeacherView,OrgCourseView,\ OrgDescView,TeacherListView,TeacherDetailView from django.urls import path, re_path urlpatterns = [ re_path('list/$', OrgView.as_view(), name="list"), re_path('add_ask/$', AddAskView.as_view(), name="add_ask"), re_path('^(?P<org_id>\d+)/$', OrgHomeView.as_view(), name="home"), re_path('^(?P<org_id>\d+)/teacher/$', OrgTeacherView.as_view(), name="teacher"), re_path('^(?P<org_id>\d+)/course/$', OrgCourseView.as_view(), name="course"), re_path('^(?P<org_id>\d+)/desc/$', OrgDescView.as_view(), name="desc"), re_path("^all_teachers/$", TeacherListView.as_view(), name="allteacher"), re_path("^teacher_detail/(?P<teacher_id>\d+)/$", TeacherDetailView.as_view(), name="teacherdetail"), ]
# -*- coding: utf-8 -*- # @File : urls.py # @Author :WeiSanJin # @Time :2021/04/06 21:39 # @Site :https://github.com/WeiSanJin from django.conf.urls import url from apps.organizations.views import OrgView, AddAskView, OrgHomeView, OrgTeacherView, OrgCourseView, OrgDescView from apps.organizations.views import TeacherListView, TeacherDetailView urlpatterns = [ url(r'^list/$', OrgView.as_view(), name="list"), url(r'^add_ask/$', AddAskView.as_view(), name="add_ask"), # path('<intt:org_id>/', OrgHomeView.as_view(), name="home") url(r'^(?P<org_id>\d+)/$', OrgHomeView.as_view(), name="home"), url(r'^teacher/(?P<org_id>\d+)/$', OrgTeacherView.as_view(), name="teacher"), url(r'^course/(?P<org_id>\d+)/$', OrgCourseView.as_view(), name="course"), url(r'^desc/(?P<org_id>\d+)/$', OrgDescView.as_view(), name="desc"), # 讲师列表页 url(r'^teachers/$', TeacherListView.as_view(), name="teachers"), # 讲师详情页 url(r'^teachers/(?P<teacher_id>\d+)/$', TeacherDetailView.as_view(), name="teacher_detail"), ]
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, LogoutView, SendSmsView, DynamicLoginView, RegisterView from apps.organizations.views import OrgView 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('d_login/', DynamicLoginView.as_view(), name='d_login'), path('logout/', LogoutView.as_view(), name='logout'), url(r'^captcha/', include('captcha.urls')), path('send_sms/', csrf_exempt(SendSmsView.as_view()), name='send_sms'), #机构相关页面 url(r'^org_list/', OrgView.as_view(), name='org_list') ]
from django.urls import path from apps.organizations.views import OrgView,AddAskView,OrgHomeView,OrgTeacherView,OrgCourseView,OrgDescView,TeacherView,TeacherDetailView urlpatterns = [ path("list/", OrgView.as_view(), name="list"), path("add_ask/", AddAskView.as_view(), name="add_ask"), path("<int:org_id>/", OrgHomeView.as_view(), name="home"), path("<int:org_id>/teacher/", OrgTeacherView.as_view(), name="teacher"), path("<int:org_id>/course/", OrgCourseView.as_view(), name="course"), path("<int:org_id>/desc/", OrgDescView.as_view(), name="desc"), path("teachers/", TeacherView.as_view(), name="teachers"), path("teachers/<int:teacher_id>/", TeacherDetailView.as_view(), name="detail"), # namespace是用于在下一个其内部的name前面添加namespace,在URL中,使用url:list进行定位 ]
from apps.operations.views import IndexView urlpatterns = [ # path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), path('', IndexView.as_view(), name="index"), path('d_login/', DynamicLoginView.as_view(), name="d_login"), path('login/', LoginView.as_view(), name="login"), path('logout', LogoutView.as_view(), name="logout"), path('register/', RegisterView.as_view(), name="register"), url(r'^captcha/', include('captcha.urls')), url(r'^send_sms/', csrf_exempt(SendSmsView.as_view()), name="send_sms"), #配置上传文件的访问url url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}), # 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'^course/', include(('apps.courses.urls', "courses"), namespace="course")), #用户相关操作 url(r'^op/', include(('apps.operations.urls', "operations"), namespace="op")), #个人中心 url(r'^users/', include(('apps.users.urls', "users"), namespace="users")), #配置富文本相关url url(r'^ueditor/', include('DjangoUeditor.urls')), ]
from django.conf.urls import url from apps.organizations.views import OrgView, AddAskView, OrgHomeView, OrgTeacherView, OrgDescView, OrgCourseView, TeacherListView from django.urls import include, path urlpatterns = [ #机构页面的url url(r"^list/$", OrgView.as_view(), name="list"), #咨询Url url(r"^add_ask/$", AddAskView.as_view(), name="add_ask"), #组织机构详细页面 路由一 #url(r'^(?P<org_id>\d+)/$',OrgHomeView.as_view(),name = "home"), #组织机构详细页面 路由二 path('<int:org_id>/', OrgHomeView.as_view(), name="home"), #机构教师列表 url(r'^(?P<org_id>\d+)/teacher/$', OrgTeacherView.as_view(), name="teacher"), #机构的介绍页 url(r"^(?P<org_id>\d+)/desc/$", OrgDescView.as_view(), name="desc"), #机构的课程页面 url(r'^(?P<org_id>\d+)/course/$', OrgCourseView.as_view(), name="course"), #讲师列表页面 url(r'^teachers/$', TeacherListView.as_view(), name="teachers"), ]
from django.urls import path from apps.organizations.views import OrgView, AddAskView, OrgHomeView, OrgTeacherView, OrgCourseView, OrgDescView, TeacherListView, TeacherDetailView app_name = 'org' urlpatterns = [ #机构相关也main path('list/', OrgView.as_view(), name='list'), path('add_ask/', AddAskView.as_view(), name='add_ask'), path('<int:org_id>/', OrgHomeView.as_view(), name='home'), path('<int:org_id>/teacher/', OrgTeacherView.as_view(), name='teacher'), path('<int:org_id>/course/', OrgCourseView.as_view(), name='course'), path('<int:org_id>/desc/', OrgDescView.as_view(), name='desc'), path('teachers/', TeacherListView.as_view(), name='teachers'), path('teachers/<int:teacher_id>/', TeacherDetailView.as_view(), name='teacher_detail'), ]
from django.contrib import admin from django.urls import path, include, re_path from django.views.generic import TemplateView from django.conf.urls import url, include from django.views.decorators.csrf import csrf_exempt # 去除单个views函数的csrf验证 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 # 引入media上传路径 urlpatterns = [ #path('admin/', admin.site.urls), #path('ueditor/', include('DjangoUeditor.urls')), path('xadmin/', xadmin.site.urls), # xadmin 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('d_login/', DynamicLoginView.as_view(), name="d_login"), # 动态验证码登录 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 path('org_list/', OrgView.as_view(), name="org_list"), # 机构列表页 ]
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 import xadmin from django.views.generic import TemplateView from apps.users.views import LoginView from apps.organizations.views import OrgView from apps.courses.views import CourseView from django.conf.urls import url, include from django.views.static import serve from MxOnline4.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('orglist/', OrgView.as_view(), name='org-list'), path('courselist/', CourseView.as_view(), name='course-list'), url(r'^org/', include(('apps.organizations.urls', 'organizations'), namespace='org')), url(r'^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}), url(r'^course/', include(('apps.courses.urls', 'courses'), namespace='courses')), ]