"""dj2 URL Configuration 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')) """ import os from django.contrib import admin from django.urls import path,include,re_path from django.conf.urls import url from django.views.static import serve from django.views.generic import TemplateView from . import views from dj2.settings import dbName as schemaName urlpatterns = [ path('xadmin/', admin.site.urls), path(r'index/',views.index), re_path(r'admin/lib/(?P.*)/(?P.*)$', views.admin_lib2), re_path(r'admin/lib/(?P.*)/(?P.*)/(?P.*)$', views.admin_lib3), re_path(r'admin/lib/(?P.*)/(?P.*)/(?P.*)/(?P.*)$', views.admin_lib4), re_path(r'admin/page/(?P.*)$', views.admin_page), re_path(r'admin/page/(?P.*)/(?P.*)$', views.admin_page2), re_path(r'admin/pages/(?P.*)$', views.admin_pages), re_path(r'admin/pages/(?P.*)/(?P.*)$', views.admin_pages2), re_path(r'front/(?P.*)$', views.schema_front1), re_path(r'front/(?P.*)/(?P.*)$', views.schema_front2), re_path(r'front/(?P.*)/(?P.*)/(?P.*)$', views.schema_front3), re_path(r'front/(?P.*)/(?P.*)/(?P.*)/(?P.*)$', views.schema_front4), re_path(r'{}/front/(?P.*)$'.format(schemaName), views.schema_front1), re_path(r'{}/front/(?P.*)/(?P.*)$'.format(schemaName), views.schema_front2), re_path(r'{}/front/(?P.*)/(?P.*)/(?P.*)$'.format(schemaName), views.schema_front3), re_path(r'{}/front/(?P.*)/(?P.*)/(?P.*)/(?P.*)$'.format(schemaName), views.schema_front4), # re_path(r'assets/(?P.*)$', views.assets1), # re_path(r'assets/(?P.*)/(?P.*)$', views.assets2), # re_path(r'assets/(?P.*)/(?P.*)/(?P.*)$', views.assets3), # re_path(r'assets/(?P.*)/(?P.*)/(?P.*)/(?P.*)$', views.assets4), #re_path(r'admin/(?P.*)$', views.admin_file1), re_path(r'admin/(?P.*)/(?P.*)$', views.admin_file2), re_path(r'admin/(?P.*)/(?P.*)/(?P.*)$', views.admin_file3), re_path(r'admin/(?P.*)/(?P.*)/(?P.*)/(?P.*)$', views.admin_file4), re_path(r'layui/(?P.*)$', views.layui1), re_path(r'layui/(?P.*)/(?P.*)$', views.layui2), re_path(r'layui/(?P.*)/(?P.*)/(?P.*)$', views.layui3), re_path(r'layui/(?P.*)/(?P.*)/(?P.*)/(?P.*)$', views.layui4), re_path(r'pages/(?P.*)$', views.front_pages), re_path(r'pages/(?P.*)/(?P.*)$', views.front_pages2), # re_path(r'pages/(?P.*)$', views.front_file1), # re_path(r'(?Pcss|jss|img|image|iamges|font|fonts)/(?P.*)$', views.front_file2), re_path(r'modules/(?P.*)$', views.front_modules), re_path(r'css/(?P.*)$', views.css1), re_path(r'js/(?P.*)$', views.js1), re_path(r'img/(?P.*)$', views.img1), path(r'test//',views.test), path(r'null',views.null), path('{}/'.format(schemaName),include('main.urls')),#导入schemaName ] #判断admin使用vue还是jquery if os.path.isdir(os.path.join(os.getcwd(),"templates/front/admin/dist/")): urlpatterns.extend([ path(r'{}/admin/dist/index.html'.format(schemaName), TemplateView.as_view(template_name='front/admin/dist/index.html')), path(r'{}/admin/'.format(schemaName), TemplateView.as_view(template_name='front/admin/dist/index.html')), # 以下是后台admin的url匹配规则 path(r'admin/dist/index.html'.format(schemaName), TemplateView.as_view(template_name='front/admin/dist/index.html')), path(r'admin/', TemplateView.as_view(template_name='front/admin/dist/index.html')), ]) else: urlpatterns.extend([ path(r'{}/admin/index.html'.format(schemaName), TemplateView.as_view(template_name='front/admin/index.html')), path(r'{}/admin/'.format(schemaName), TemplateView.as_view(template_name='front/admin/index.html')), # 以下是后台admin的url匹配规则 path(r'admin/index.html'.format(schemaName), TemplateView.as_view(template_name='front/admin/index.html')), path(r'admin/', TemplateView.as_view(template_name='front/admin/index.html')), ]) if os.path.isfile(os.path.join(os.getcwd(),"templates/front/index.html")): urlpatterns.extend([ path(r'index.html', TemplateView.as_view(template_name='front/index.html')), path(r'{}/index.html'.format(schemaName), TemplateView.as_view(template_name='front/index.html')), path(r'{}/front/index.html'.format(schemaName), TemplateView.as_view(template_name='front/index.html')), path(r'', TemplateView.as_view(template_name='front/index.html')), ])