The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ 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.urls import path, re_path from django.views.static import serve import xadmin from users.views import IndexView,AboutView,GalleryView,ContactView,ProductsView from AnJiuMei.settings import MEDIA_ROOT,STATICFILES_DIRS urlpatterns = [ path('xadmin/', xadmin.site.urls), path('',IndexView.as_view(),name='index'), path('about',AboutView.as_view(),name='about'), path('gallery',GalleryView.as_view(),name='gallery'), path('contact',ContactView.as_view(),name='contact'), path('products', ProductsView.as_view(), name='products'), re_path('static/(?P<path>.*)', serve, {'document_root': STATICFILES_DIRS}), re_path('media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}), ]
# ), # name='django_registration_activation_complete'), # path('activate/<activation_key>/', # ActivationView.as_view(), # name='django_registration_activate' # ), path( r"register/", UserRegistrationView.as_view(success_url="/"), name="django_registration_register", ), path(r"", include("django_registration.backends.one_step.urls")), path(r"login/", custom_login, name="login"), path(r"", include("django.contrib.auth.urls")), path( "access/<uuid:turker_uuid>/", redirect_turker_to_messages_view, name="redirect_turker", ), path("admin/", admin.site.urls), path("about/", AboutView.as_view(), name="about"), path("sobre/", SobreView.as_view(), name="sobre"), path("tos/", ToSView.as_view(), name="tos"), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) if settings.DEBUG: import debug_toolbar urlpatterns = [path("__debug__/", include(debug_toolbar.urls)) ] + urlpatterns
""" import xadmin from django.urls import path,include,re_path from django.conf import settings #上传图片 from django.conf.urls.static import static #上传图片 from users.views import IndexView, AboutView, ContactUsView, LoginView,LogoutView from operation.views import OrderListView, OrderAjax, OrderDetailAjaxView, LeagueView from rooms.views import ReserveRoomView, ReservePackageView urlpatterns = [ path('xadmin/', xadmin.site.urls, name="xadmin"), path('captcha/',include('captcha.urls')), #验证码 path('ueditor/', include('DjangoUeditor.urls')), #富文本 path('login/', LoginView.as_view(), name="login"), # 登录 path('logout/',LogoutView.as_view(),name="logout"), #注销 path('', IndexView.as_view(), name="index"), # 首页 path('about/', AboutView.as_view(), name="about"), # 关于我们 path('contact_us/', ContactUsView.as_view(), name="contact_us"), # 联系我们 path('reserve_room/', ReserveRoomView.as_view(), name="reserve_room"), # 选择房间 path('reserve_package/', ReservePackageView.as_view(), name="reserve_package"), # 选择套餐 path('order_ajax/', OrderAjax.as_view(), name="order_ajax"), # 添加订单 path('order_list/', OrderListView.as_view(), name="order_list"), # 订单列表 path('order_detail/', OrderDetailAjaxView.as_view(), name="order_detail"), # 订单详情 path('league_ajax/', LeagueView.as_view(), name="league_ajax"), #加盟 ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import url from users.views import IndexView, AboutView, BlogInputView, BlogsView, page_not_found, page_error from articles.views import ArticleView from tags.views import TagView from classes.views import TypeView from archives.views import ArchivesView from settings import MEDIA_ROOT from django.views.static import serve # from django.contrib import admin urlpatterns = [ # url(r'^admin/', admin.site.urls), url(r'^xadmin/', xadmin.site.urls), url(r'^index/', IndexView.as_view(), name="index"), url(r'^$', IndexView.as_view(), name="index"), url(r"^tags/", TagView.as_view(), name="tags"), url(r"^types", TypeView.as_view(), name="types"), url(r"^archives", ArchivesView.as_view(), name="archives"), url(r"^about", AboutView.as_view(), name="about"), url(r'^blog/', ArticleView.as_view(), name="blog"), url(r"^issue", BlogInputView.as_view(), name="issue"), url(r"^admin", BlogsView.as_view(), name="admin"), # 配置上传函数 url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}), ] # 全局404页面配置 handler404 = page_not_found handler500 = page_error
# 邮箱激活 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>.*)/$', ResetView.as_view(), name="reset_pwd"), url(r'^modify_pwd/$', ModifyView.as_view(), name="modify_pwd"), # 配置上传文件的访问处理函数 url(r'^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}), # 用户 url(r"^userinfo/", include('users.urls', namespace='userinfo')), # 关于作者 url(r"^about/$", AboutView.as_view(), name='about'), # 三言两语 url(r"^sanyan/$", SanYanView.as_view(), name='sanyan'), # 文章 url(r"^article/", include('articles.urls', namespace='article')), # ueditor编辑器 url(r'^ueditor/', include('DjangoUeditor.urls')), # 配置static,解决debug为false时static路径设置无效 url(r'^static/(?P<path>.*)$', serve, {'document_root': STATIC_ROOT}), ] # 全局404页面配置 handler404 = 'users.views.page_not_found' # 全局500页面配置 handler500 = 'users.views.page_error'
from MxOnline.settings import MEDIA_ROOT, STATIC_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url(r'^$', IndexView.as_view(), name="index"), # url(r'^login/$', TemplateView.as_view(template_name="login.html"), name="login"), # url(r'^login/$', user_login, name="login"), 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<reset_code>.*)/$', RestView.as_view(), name="reset_pwd"), url(r'^modify_pwd/$', ModifyPwdView.as_view(), name="modify_pwd"), url(r'^about/$', AboutView.as_view(), name="about"), # 课程机构URL配置 url(r'^org/', include('organization.urls', namespace="org")), # 课程列表 url(r'^course/', include('courses.urls', namespace="course")), # 博客 url(r'^blogs/',include('blog.urls',namespace='blog')), # 新闻 url(r'^news/',include('news.urls',namespace='news')), # 用户 url(r'^users/', include('users.urls', namespace="users")),