parent
baa4245569
commit
dfd8a3c80a
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="django6o293@localhost" uuid="ced7ba72-70fa-4aec-bfe7-bbc19ab2575b">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306/django6o293</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="django" name="Django">
|
||||
<configuration>
|
||||
<option name="rootFolder" value="$MODULE_DIR$" />
|
||||
<option name="settingsModule" value="dj2/settings.py" />
|
||||
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
|
||||
<option name="environment" value="<map/>" />
|
||||
<option name="doNotUseTestRunner" value="false" />
|
||||
<option name="trackFilePattern" value="migrations" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="format" value="PLAIN" />
|
||||
<option name="myDocStringFormat" value="Plain" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,12 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="N801" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (django6o293)" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/django6o293.iml" filepath="$PROJECT_DIR$/.idea/django6o293.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,9 @@
|
||||
[sql]
|
||||
;support two sql,mysql and mssql,choose one
|
||||
type = mysql
|
||||
host = 127.0.0.1
|
||||
port = 3306
|
||||
user = root
|
||||
passwd = 123456
|
||||
db = django6o293
|
||||
charset = utf8
|
@ -0,0 +1,3 @@
|
||||
import pymysql
|
||||
|
||||
pymysql.install_as_MySQLdb()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,171 @@
|
||||
"""
|
||||
Django settings for dj2 project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.0.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.0/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
from util.configread import config_read
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'w5yn#0gn2tt7pvu%hvwt0!lt=!$6+eqp4%m8)u3u#gknm@jm)k'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
"main",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
# 'django.middleware.csrf.CsrfViewMiddleware',#Forbidden (CSRF cookie not set.)
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'threadlocals.middleware.ThreadLocalMiddleware',
|
||||
"xmiddleware.xparam.Xparam",
|
||||
"xmiddleware.xauth.Xauth",
|
||||
|
||||
]
|
||||
|
||||
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
|
||||
SESSION_COOKIE_NAME = "sessionid"
|
||||
SESSION_COOKIE_PATH = "/"
|
||||
SESSION_COOKIE_DOMAIN = None
|
||||
SESSION_COOKIE_SECURE = False
|
||||
SESSION_COOKIE_HTTPONLY = True
|
||||
SESSION_COOKIE_AGE = 1209600
|
||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
|
||||
SESSION_SAVE_EVERY_REQUEST = False
|
||||
|
||||
ROOT_URLCONF = 'dj2.urls'
|
||||
TEMPLATES_DIR = os.path.join(BASE_DIR, "templates")
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [TEMPLATES_DIR],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'dj2.wsgi.application'
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
|
||||
|
||||
# DATABASES = {
|
||||
# 'default': {
|
||||
# 'ENGINE': 'django.db.backends.sqlite3',
|
||||
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
# }
|
||||
# }
|
||||
|
||||
dbtype, host, port, user, passwd, dbName, charset = config_read("config.ini")
|
||||
dbName=dbName.replace(" ","").strip()
|
||||
print(dbtype, host, port, user, passwd, dbName, charset)
|
||||
|
||||
if dbtype == 'mysql':
|
||||
DATABASES = {
|
||||
'default': {
|
||||
# 'ENGINE': 'django.db.backends.sqlite3',
|
||||
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'OPTIONS': {
|
||||
'sql_mode': 'traditional',
|
||||
'init_command': "SET sql_mode='traditional'", # STRICT_TRANS_TABLES
|
||||
},
|
||||
'NAME': dbName,
|
||||
'USER': user,
|
||||
'PASSWORD': passwd,
|
||||
'HOST': host,
|
||||
'PORT': port,
|
||||
'charset': charset,
|
||||
'TEST': {
|
||||
'CHARSET': charset,
|
||||
'COLLATION': 'utf8_general_ci',
|
||||
},
|
||||
'CONN_MAX_AGE':60
|
||||
},
|
||||
}
|
||||
else:
|
||||
print("请使用mysql5.5数据库")
|
||||
os._exit(1)
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.0/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'zh-Hans'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.0/howto/static-files/
|
||||
|
||||
|
||||
|
||||
STATIC_URL = '/assets/'
|
||||
STATICFILES_DIRS =[
|
||||
os.path.join(BASE_DIR, "templates/front/assets"),
|
||||
]
|
||||
|
||||
# media
|
||||
MEDIA_URL = "/media/" # 自定义
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') # 自定义
|
||||
if os.path.isdir(MEDIA_ROOT) == False:
|
||||
os.mkdir(MEDIA_ROOT)
|
@ -0,0 +1,101 @@
|
||||
"""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<p1>.*)/(?P<p2>.*)$', views.admin_lib2),
|
||||
re_path(r'admin/lib/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)$', views.admin_lib3),
|
||||
re_path(r'admin/lib/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)/(?P<p4>.*)$', views.admin_lib4),
|
||||
re_path(r'admin/page/(?P<p1>.*)$', views.admin_page),
|
||||
re_path(r'admin/page/(?P<p1>.*)/(?P<p2>.*)$', views.admin_page2),
|
||||
re_path(r'admin/pages/(?P<p1>.*)$', views.admin_pages),
|
||||
re_path(r'admin/pages/(?P<p1>.*)/(?P<p2>.*)$', views.admin_pages2),
|
||||
|
||||
re_path(r'front/(?P<p1>.*)$', views.schema_front1),
|
||||
re_path(r'front/(?P<p1>.*)/(?P<p2>.*)$', views.schema_front2),
|
||||
re_path(r'front/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)$', views.schema_front3),
|
||||
re_path(r'front/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)/(?P<p4>.*)$', views.schema_front4),
|
||||
re_path(r'{}/front/(?P<p1>.*)$'.format(schemaName), views.schema_front1),
|
||||
re_path(r'{}/front/(?P<p1>.*)/(?P<p2>.*)$'.format(schemaName), views.schema_front2),
|
||||
re_path(r'{}/front/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)$'.format(schemaName), views.schema_front3),
|
||||
re_path(r'{}/front/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)/(?P<p4>.*)$'.format(schemaName), views.schema_front4),
|
||||
# re_path(r'assets/(?P<p1>.*)$', views.assets1),
|
||||
# re_path(r'assets/(?P<p1>.*)/(?P<p2>.*)$', views.assets2),
|
||||
# re_path(r'assets/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)$', views.assets3),
|
||||
# re_path(r'assets/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)/(?P<p4>.*)$', views.assets4),
|
||||
#re_path(r'admin/(?P<p1>.*)$', views.admin_file1),
|
||||
re_path(r'admin/(?P<p1>.*)/(?P<p2>.*)$', views.admin_file2),
|
||||
re_path(r'admin/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)$', views.admin_file3),
|
||||
re_path(r'admin/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)/(?P<p4>.*)$', views.admin_file4),
|
||||
re_path(r'layui/(?P<p1>.*)$', views.layui1),
|
||||
re_path(r'layui/(?P<p1>.*)/(?P<p2>.*)$', views.layui2),
|
||||
re_path(r'layui/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)$', views.layui3),
|
||||
re_path(r'layui/(?P<p1>.*)/(?P<p2>.*)/(?P<p3>.*)/(?P<p4>.*)$', views.layui4),
|
||||
re_path(r'pages/(?P<p1>.*)$', views.front_pages),
|
||||
re_path(r'pages/(?P<p1>.*)/(?P<p2>.*)$', views.front_pages2),
|
||||
# re_path(r'pages/(?P<p1>.*)$', views.front_file1),
|
||||
# re_path(r'(?P<p1>css|jss|img|image|iamges|font|fonts)/(?P<p2>.*)$', views.front_file2),
|
||||
re_path(r'modules/(?P<p1>.*)$', views.front_modules),
|
||||
re_path(r'css/(?P<p1>.*)$', views.css1),
|
||||
re_path(r'js/(?P<p1>.*)$', views.js1),
|
||||
re_path(r'img/(?P<p1>.*)$', views.img1),
|
||||
path(r'test/<str:p1>/',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')),
|
||||
])
|
@ -0,0 +1,963 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
import os,sys
|
||||
from django.http import JsonResponse, HttpResponse
|
||||
from django.apps import apps
|
||||
|
||||
|
||||
def index(request):
|
||||
if request.method in ["GET", "POST"]:
|
||||
msg = {"code": 200, "msg": "success", "data": []}
|
||||
print("=================>index")
|
||||
# allModels = apps.get_app_config('main').get_models()
|
||||
# for m in allModels:
|
||||
# print(m.__tablename__)
|
||||
# print(dir(m))
|
||||
# # for col in m._meta.fields:
|
||||
# # print("col name============>",col.name)
|
||||
# # print("col type============>",col.get_internal_type())
|
||||
# print(allModels)
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def test(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
msg = {"code": 200, "msg": "success", "data": []}
|
||||
print("=================>index ", p1)
|
||||
return JsonResponse(msg)
|
||||
|
||||
def null(request,):
|
||||
if request.method in ["GET", "POST"]:
|
||||
msg = {"code": 200, "msg": "success", "data": []}
|
||||
return JsonResponse(msg)
|
||||
|
||||
def check_suffix(filelName,path1):
|
||||
try:
|
||||
image_data = open(path1, "rb").read()
|
||||
except:
|
||||
image_data = "no file"
|
||||
if '.js' in filelName:
|
||||
return HttpResponse(image_data, content_type="application/javascript")
|
||||
elif '.jpg' in filelName or '.jpeg' in filelName or '.png' in filelName or '.gif' in filelName:
|
||||
return HttpResponse(image_data, content_type="image/png")
|
||||
elif '.css' in filelName:
|
||||
return HttpResponse(image_data, content_type="text/css")
|
||||
elif '.ttf' in filelName or '.woff' in filelName:
|
||||
return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
elif '.mp4' in filelName:
|
||||
return HttpResponse(image_data, content_type="video/mp4")
|
||||
elif '.mp3' in filelName:
|
||||
return HttpResponse(image_data, content_type="audio/mp3")
|
||||
elif '.csv' in filelName:
|
||||
return HttpResponse(image_data, content_type="application/CSV")
|
||||
elif '.doc' in filelName:
|
||||
return HttpResponse(image_data, content_type="application/msword")
|
||||
elif '.docx' in filelName:
|
||||
return HttpResponse(image_data, content_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document")
|
||||
elif '.xls' in filelName:
|
||||
return HttpResponse(image_data, content_type="application/vnd.ms-excel")
|
||||
elif '.xlsx' in filelName:
|
||||
return HttpResponse(image_data, content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||
elif '.ppt' in filelName:
|
||||
return HttpResponse(image_data, content_type="application/vnd.ms-powerpoint")
|
||||
elif '.pptx' in filelName:
|
||||
return HttpResponse(image_data, content_type="application/vnd.openxmlformats-officedocument.presentationml.presentation")
|
||||
else:
|
||||
return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
def admin_lib2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/lib/", p1, p2)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_lib3(request, p1, p2, p3):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/lib/", p1, p2, p3)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p3:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p3 or '.woff' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p3:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p3:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_lib4(request, p1, p2, p3, p4):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/lib/", p1, p2, p3, p4)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p4:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p4 or '.woff' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p4:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p4:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_page(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/page/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_page2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/page/", p1, p2)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_pages(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/pages/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_pages2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/pages/", p1, p2)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_file1(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_file2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/", p1, p2)
|
||||
if not os.path.isfile(path1):
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/dist/", p1, p2)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_file3(request, p1, p2, p3):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/", p1, p2, p3)
|
||||
|
||||
if not os.path.isfile(path1):
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/dist/", p1, p2,p3)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p3:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p3 or '.woff' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p3:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p3:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def admin_file4(request, p1, p2, p3, p4):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/", p1, p2, p3, p4)
|
||||
if not os.path.isfile(path1):
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/admin/dist/", p1, p2,p3,p4)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p4:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p4 or '.woff' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p4:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p4:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
def front_pages(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/pages/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def front_pages2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/pages/", p1, p2)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def layui1(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/layui/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def layui2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/layui/", p1, p2)
|
||||
print("layui2 path1========================>",path1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def layui3(request, p1, p2, p3):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/layui/", p1, p2, p3)
|
||||
print("layui3 path1========================>",path1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
#
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p3:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p3 or '.woff' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p3:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p3:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def layui4(request, p1, p2, p3, p4):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/layui/", p1, p2, p3, p4)
|
||||
print("layui4 path1========================>",path1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p4:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p4 or '.woff' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p4:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p4:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def pages1(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/pages/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def pages2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/pages/", p1, p2)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def front_file1(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def front_file2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/", p1, p2)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
def schema_front1(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def schema_front2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/", p1, p2)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def schema_front3(request, p1, p2, p3):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/", p1, p2, p3)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p3:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p3 or '.woff' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p3:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p3:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def schema_front4(request, p1, p2, p3, p4):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/", p1, p2, p3, p4)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p4:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p4 or '.woff' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p4:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p4:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
def assets1(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/assets/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# elif '.map' in p1:
|
||||
# return JsonResponse({})
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def assets2(request, p1, p2):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/assets/", p1, p2)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p2 or '.jpeg' in p2 or '.png' in p2 or '.gif' in p2:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p2:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p2 or '.woff' in p2:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p2:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p2:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# elif '.map' in p2:
|
||||
# return JsonResponse({})
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def assets3(request, p1, p2, p3):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/assets/", p1, p2, p3)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p3 or '.jpeg' in p3 or '.png' in p3 or '.gif' in p3:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p3:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p3 or '.woff' in p3:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p3:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p3:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# elif '.map' in p3:
|
||||
# return JsonResponse({})
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
|
||||
def assets4(request, p1, p2, p3, p4):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/assets/", p1, p2, p3, p4)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p4 or '.jpeg' in p4 or '.png' in p4 or '.gif' in p4:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p4:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p4 or '.woff' in p4:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p4:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p4:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# elif '.map' in p4:
|
||||
# return JsonResponse({})
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
def css1(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/css/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
def js1(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/js/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
|
||||
def img1(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/img/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
||||
|
||||
# try:
|
||||
# image_data = open(path1, "rb").read()
|
||||
# except:
|
||||
# image_data="no file"
|
||||
# if '.js' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/javascript")
|
||||
# elif '.jpg' in p1 or '.jpeg' in p1 or '.png' in p1 or '.gif' in p1:
|
||||
# return HttpResponse(image_data, content_type="image/png")
|
||||
# elif '.css' in p1:
|
||||
# return HttpResponse(image_data, content_type="text/css")
|
||||
# elif '.ttf' in p1 or '.woff' in p1:
|
||||
# return HttpResponse(image_data, content_type="application/octet-stream")
|
||||
# elif '.mp4' in p1:
|
||||
# return HttpResponse(image_data, content_type="video/mp4")
|
||||
# elif '.mp3' in p1:
|
||||
# return HttpResponse(image_data, content_type="audio/mp3")
|
||||
# else:
|
||||
# return HttpResponse(image_data, content_type="text/html")
|
||||
def front_modules(request, p1):
|
||||
if request.method in ["GET", "POST"]:
|
||||
fullPath = request.get_full_path()
|
||||
print("{}=============>".format(sys._getframe().f_code.co_name), fullPath)
|
||||
path1 = os.path.join(os.getcwd(), "templates/front/modules/", p1)
|
||||
|
||||
return check_suffix(eval(eval(sys._getframe().f_code.co_name).__code__.co_varnames[-3]),path1)
|
@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for dj2 project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dj2.settings")
|
||||
|
||||
application = get_wsgi_application()
|
@ -0,0 +1,53 @@
|
||||
# coding:utf-8
|
||||
# author:ila
|
||||
import click,py_compile,os
|
||||
from configparser import ConfigParser
|
||||
from util.configread import config_read
|
||||
from util.sqlinit import Create
|
||||
@click.group()
|
||||
def sub():
|
||||
pass
|
||||
|
||||
|
||||
@click.command()
|
||||
def initdb(ini="config.ini"):
|
||||
dbtype, host, port, user, passwd, dbName, charset = config_read(ini)
|
||||
if dbtype == 'mysql':
|
||||
cm = Create(dbtype, host, port, user, passwd, dbName, charset)
|
||||
cm.create_db("CREATE DATABASE IF NOT EXISTS `{}` /*!40100 DEFAULT CHARACTER SET utf8 */ ;".format(dbName))
|
||||
|
||||
cm.conn_close()
|
||||
elif dbtype == 'mssql':
|
||||
cm = Create(dbtype, host, port, user, passwd, dbName, charset)
|
||||
cm.create_db("CREATE DATABASE IF NOT EXISTS `{}` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;".format(dbName))
|
||||
|
||||
cm.conn_close()
|
||||
else:
|
||||
print('请修改当前面目录下的config.ini文件')
|
||||
|
||||
@click.command()
|
||||
def initsql(ini="config.ini"):
|
||||
dbtype, host, port, user, passwd, dbName, charset = config_read(ini)
|
||||
if dbtype == 'mysql':
|
||||
cm = Create(dbtype, host, port, user, passwd, dbName, charset)
|
||||
cm.create_db("CREATE DATABASE IF NOT EXISTS `{}` /*!40100 DEFAULT CHARACTER SET utf8 */ ;".format(dbName))
|
||||
with open("./db/mysql.sql", encoding="utf8") as f:
|
||||
createsql = f.read()
|
||||
createsql = "DROP TABLE" + createsql.split('DROP TABLE', 1)[-1]
|
||||
cm.create_tables(createsql.split(';')[:-1])
|
||||
cm.conn_close()
|
||||
elif dbtype == 'mssql':
|
||||
cm = Create(dbtype, host, port, user, passwd, dbName, charset)
|
||||
cm.create_db("CREATE DATABASE IF NOT EXISTS `{}` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;".format(dbName))
|
||||
with open("./db/mssql.sql", encoding="utf8") as f:
|
||||
createsql = f.read()
|
||||
createsql = "DROP TABLE" + createsql.split('DROP TABLE', 1)[-1]
|
||||
cm.create_tables(createsql.split(';')[:-1])
|
||||
cm.conn_close()
|
||||
else:
|
||||
print('请修改当前面目录下的config.ini文件')
|
||||
|
||||
sub.add_command(initdb,"initdb")
|
||||
sub.add_command(initsql,"initsql")
|
||||
if __name__ == "__main__":
|
||||
sub()
|
@ -0,0 +1 @@
|
||||
default_app_config = 'main.apps.MainConfig'
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,31 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from django.apps import apps, AppConfig
|
||||
# Register your models here.
|
||||
|
||||
from dj2.settings import dbName as schemaName
|
||||
from main.users_model import users
|
||||
from main.config_model import config
|
||||
|
||||
try:
|
||||
from main.models import *
|
||||
except:
|
||||
pass
|
||||
# change title
|
||||
admin.site.site_title = schemaName # 设置页面标题
|
||||
admin.site.site_header = schemaName # 设置网站页头
|
||||
admin.site.index_title = schemaName # 设置首页标语
|
||||
|
||||
allModels = apps.get_app_config('main').get_models()
|
||||
|
||||
for ind, model in enumerate(allModels):
|
||||
|
||||
class modelsite(admin.ModelAdmin):
|
||||
list_display = []
|
||||
for col in model._meta.fields:
|
||||
list_display.append(col.name)
|
||||
|
||||
search_fields = list_display
|
||||
|
||||
|
||||
admin.site.register(model, modelsite)
|
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class MainConfig(AppConfig):
|
||||
name = 'main'
|
||||
verbose_name = verbose_name_plural = r'刷表模块'
|
@ -0,0 +1,21 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
from django.db import models
|
||||
|
||||
from .model import BaseModel
|
||||
|
||||
|
||||
class config(BaseModel):
|
||||
# id=models.BigIntegerField(verbose_name="自增id")
|
||||
name = models.CharField(max_length=100, verbose_name=u'键名')
|
||||
value = models.CharField(max_length=100, verbose_name=u'键值')
|
||||
|
||||
__tablename__ = 'config'
|
||||
|
||||
class Meta:
|
||||
db_table = 'config'
|
||||
verbose_name = verbose_name_plural = u'配置表'
|
||||
|
||||
# def __str__(self):
|
||||
# return self.name
|
@ -0,0 +1,131 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
import logging
|
||||
|
||||
from django.http import JsonResponse
|
||||
|
||||
from .config_model import config
|
||||
from util.codes import *
|
||||
from util import message as mes
|
||||
|
||||
|
||||
def config_page(request):
|
||||
'''
|
||||
获取参数信息
|
||||
:return:
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code,
|
||||
"data": {"currPage": 1, "totalPage": 1, "total": 1, "pageSize": 10, "list": []}}
|
||||
req_dict = request.session.get('req_dict')
|
||||
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
|
||||
msg['data']['pageSize'] = config.page(config, config, req_dict)
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_list(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code,
|
||||
"data": {"currPage": 1, "totalPage": 1, "total": 1, "pageSize": 10, "list": []}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
|
||||
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
|
||||
msg['data']['pageSize'] = config.page(config, config, req_dict)
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_info(request, id_):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
data = config.getbyid(config, config, int(id_))
|
||||
if len(data) > 0:
|
||||
msg['data'] = data[0]
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_detail(request, id_):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
data = config.getbyid(config, config, int(id_))
|
||||
if len(data) > 0:
|
||||
msg['data'] = data[0]
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_save(request):
|
||||
'''
|
||||
创建参数信息
|
||||
:return:
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
req_dict = request.session.get('req_dict')
|
||||
param1 = config.getbyparams(config, config, req_dict)
|
||||
if param1:
|
||||
msg['code'] = id_exist_code
|
||||
msg['msg'] = mes.id_exist_code
|
||||
return JsonResponse(msg)
|
||||
|
||||
error = config.createbyreq(config, config, req_dict)
|
||||
logging.warning("save_config.res=========>{}".format(error))
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_add(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
|
||||
error = config.createbyreq(config, config, req_dict)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_update(request):
|
||||
'''
|
||||
更新参数信息
|
||||
:return:
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
req_dict = request.session.get('req_dict')
|
||||
|
||||
config.updatebyparams(config, config, req_dict)
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_delete(request):
|
||||
'''
|
||||
删除参数信息
|
||||
:return:
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
req_dict = request.session.get('req_dict')
|
||||
config.deletes(config,
|
||||
config,
|
||||
req_dict.get("ids")
|
||||
)
|
||||
|
||||
return JsonResponse(msg)
|
@ -0,0 +1,219 @@
|
||||
# Generated by Django 2.0 on 2022-08-14 05:19
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='cheweileixing',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweileixing', models.CharField(max_length=255, unique=True, verbose_name='车位类型')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '车位类型',
|
||||
'verbose_name_plural': '车位类型',
|
||||
'db_table': 'cheweileixing',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='cheweiweihu',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweibianhao', models.CharField(max_length=255, verbose_name='车位编号')),
|
||||
('cheweimingcheng', models.CharField(max_length=255, null=True, verbose_name='车位名称')),
|
||||
('cheweileixing', models.CharField(max_length=255, null=True, verbose_name='车位类型')),
|
||||
('cheweiweizhi', models.CharField(max_length=255, null=True, verbose_name='车位位置')),
|
||||
('weihuleixing', models.CharField(max_length=255, verbose_name='维护类型')),
|
||||
('weihuxiangmu', models.CharField(max_length=255, null=True, verbose_name='维护项目')),
|
||||
('weihushijian', models.DateTimeField(verbose_name='维护时间')),
|
||||
('weihuxiangqing', models.TextField(null=True, verbose_name='维护详情')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '车位维护',
|
||||
'verbose_name_plural': '车位维护',
|
||||
'db_table': 'cheweiweihu',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='cheweixinxi',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweibianhao', models.CharField(max_length=255, unique=True, verbose_name='车位编号')),
|
||||
('cheweimingcheng', models.CharField(max_length=255, null=True, verbose_name='车位名称')),
|
||||
('cheweileixing', models.CharField(max_length=255, null=True, verbose_name='车位类型')),
|
||||
('cheweitupian', models.CharField(max_length=255, null=True, verbose_name='车位图片')),
|
||||
('cheweiweizhi', models.CharField(max_length=255, null=True, verbose_name='车位位置')),
|
||||
('cheweizhuangtai', models.CharField(max_length=255, verbose_name='车位状态')),
|
||||
('tingchejiage', models.IntegerField(verbose_name='停车价格')),
|
||||
('shoufeibiaozhun', models.CharField(max_length=255, null=True, verbose_name='收费标准')),
|
||||
('cheweixiangqing', models.TextField(null=True, verbose_name='车位详情')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '车位信息',
|
||||
'verbose_name_plural': '车位信息',
|
||||
'db_table': 'cheweixinxi',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='chuchangjiaofei',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweibianhao', models.CharField(max_length=255, verbose_name='车位编号')),
|
||||
('cheweimingcheng', models.CharField(max_length=255, null=True, verbose_name='车位名称')),
|
||||
('cheweileixing', models.CharField(max_length=255, null=True, verbose_name='车位类型')),
|
||||
('cheweitupian', models.CharField(max_length=255, null=True, verbose_name='车位图片')),
|
||||
('tingchejiage', models.IntegerField(null=True, verbose_name='停车价格')),
|
||||
('ruchangshijian', models.CharField(max_length=255, null=True, verbose_name='入场时间')),
|
||||
('chuchangshijian', models.DateTimeField(verbose_name='出场时间')),
|
||||
('tingcheshizhang', models.IntegerField(verbose_name='停车时长')),
|
||||
('tingchefeiyong', models.IntegerField(null=True, verbose_name='停车费用')),
|
||||
('xinxibeizhu', models.CharField(max_length=255, null=True, verbose_name='信息备注')),
|
||||
('yonghuming', models.CharField(max_length=255, null=True, verbose_name='用户名')),
|
||||
('shouji', models.CharField(max_length=255, null=True, verbose_name='手机')),
|
||||
('chepai', models.CharField(max_length=255, null=True, verbose_name='车牌')),
|
||||
('sfsh', models.CharField(default='否', max_length=255, null=True, verbose_name='是否审核')),
|
||||
('shhf', models.TextField(null=True, verbose_name='审核回复')),
|
||||
('ispay', models.CharField(default='未支付', max_length=255, null=True, verbose_name='是否支付')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '出场缴费',
|
||||
'verbose_name_plural': '出场缴费',
|
||||
'db_table': 'chuchangjiaofei',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='config',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=100, verbose_name='键名')),
|
||||
('value', models.CharField(max_length=100, verbose_name='键值')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '配置表',
|
||||
'verbose_name_plural': '配置表',
|
||||
'db_table': 'config',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='huiyuan',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('yonghuming', models.CharField(max_length=255, unique=True, verbose_name='用户名')),
|
||||
('mima', models.CharField(max_length=255, verbose_name='密码')),
|
||||
('xingming', models.CharField(max_length=255, null=True, verbose_name='姓名')),
|
||||
('touxiang', models.CharField(max_length=255, null=True, verbose_name='头像')),
|
||||
('xingbie', models.CharField(max_length=255, null=True, verbose_name='性别')),
|
||||
('shouji', models.CharField(max_length=255, null=True, verbose_name='手机')),
|
||||
('chepai', models.CharField(max_length=255, null=True, verbose_name='车牌')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '会员',
|
||||
'verbose_name_plural': '会员',
|
||||
'db_table': 'huiyuan',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='messages',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('userid', models.BigIntegerField(verbose_name='留言人id')),
|
||||
('username', models.CharField(max_length=255, null=True, verbose_name='用户名')),
|
||||
('content', models.TextField(verbose_name='留言内容')),
|
||||
('reply', models.TextField(null=True, verbose_name='回复内容')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '留言板',
|
||||
'verbose_name_plural': '留言板',
|
||||
'db_table': 'messages',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='news',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('title', models.CharField(max_length=255, verbose_name='标题')),
|
||||
('introduction', models.TextField(null=True, verbose_name='简介')),
|
||||
('picture', models.CharField(max_length=255, verbose_name='图片')),
|
||||
('content', models.TextField(verbose_name='内容')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '公告信息',
|
||||
'verbose_name_plural': '公告信息',
|
||||
'db_table': 'news',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ruchangtingche',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweibianhao', models.CharField(max_length=255, verbose_name='车位编号')),
|
||||
('cheweimingcheng', models.CharField(max_length=255, null=True, verbose_name='车位名称')),
|
||||
('cheweileixing', models.CharField(max_length=255, null=True, verbose_name='车位类型')),
|
||||
('cheweitupian', models.CharField(max_length=255, null=True, verbose_name='车位图片')),
|
||||
('cheweiweizhi', models.CharField(max_length=255, null=True, verbose_name='车位位置')),
|
||||
('cheweizhuangtai', models.CharField(max_length=255, null=True, verbose_name='车位状态')),
|
||||
('shoufeibiaozhun', models.CharField(max_length=255, null=True, verbose_name='收费标准')),
|
||||
('tingchejiage', models.IntegerField(null=True, verbose_name='停车价格')),
|
||||
('ruchangshijian', models.DateTimeField(verbose_name='入场时间')),
|
||||
('ruchangbeizhu', models.CharField(max_length=255, null=True, verbose_name='入场备注')),
|
||||
('yonghuming', models.CharField(max_length=255, null=True, verbose_name='用户名')),
|
||||
('shouji', models.CharField(max_length=255, null=True, verbose_name='手机')),
|
||||
('chepai', models.CharField(max_length=255, null=True, verbose_name='车牌')),
|
||||
('sfsh', models.CharField(default='否', max_length=255, null=True, verbose_name='是否审核')),
|
||||
('shhf', models.TextField(null=True, verbose_name='审核回复')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '入场停车',
|
||||
'verbose_name_plural': '入场停车',
|
||||
'db_table': 'ruchangtingche',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='storeup',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('userid', models.BigIntegerField(verbose_name='用户id')),
|
||||
('refid', models.BigIntegerField(null=True, verbose_name='收藏id')),
|
||||
('tablename', models.CharField(max_length=255, null=True, verbose_name='表名')),
|
||||
('name', models.CharField(max_length=255, verbose_name='收藏名称')),
|
||||
('picture', models.CharField(max_length=255, verbose_name='收藏图片')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '收藏表',
|
||||
'verbose_name_plural': '收藏表',
|
||||
'db_table': 'storeup',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='users',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('username', models.CharField(max_length=100, verbose_name='账号')),
|
||||
('password', models.CharField(max_length=100, verbose_name='密码')),
|
||||
('role', models.CharField(max_length=100, verbose_name='角色')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '管理员表',
|
||||
'verbose_name_plural': '管理员表',
|
||||
'db_table': 'users',
|
||||
},
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
@ -0,0 +1,148 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
import os
|
||||
from django.urls import path
|
||||
from main import users_v, config_v, schema_v
|
||||
|
||||
# from dj2.settings import dbName as schemaName
|
||||
|
||||
# url规则列表
|
||||
urlpatterns = [
|
||||
path(r'users/register', users_v.users_register),
|
||||
path(r'users/login', users_v.users_login),
|
||||
path(r'users/logout', users_v.users_logout),
|
||||
path(r'users/session', users_v.users_session),
|
||||
path(r'users/page', users_v.users_page),
|
||||
path(r'users/save', users_v.users_save),
|
||||
path(r'users/info/<id_>', users_v.users_info),
|
||||
path(r'users/update', users_v.users_update),
|
||||
path(r'users/delete', users_v.users_delete),
|
||||
|
||||
path(r'config/page', config_v.config_page),
|
||||
path(r'config/list', config_v.config_list),
|
||||
path(r'config/save', config_v.config_save),
|
||||
path(r'config/add', config_v.config_add),
|
||||
path(r'config/info/<id_>', config_v.config_info),
|
||||
path(r'config/detail/<id_>', config_v.config_detail),
|
||||
path(r'config/update', config_v.config_update),
|
||||
path(r'config/delete', config_v.config_delete),
|
||||
|
||||
]
|
||||
# main app的路径
|
||||
mainDir = os.path.join(os.getcwd(), "main")
|
||||
|
||||
# 过滤文件的列表
|
||||
excludeList = [
|
||||
"schema_v.py",
|
||||
"users_v.py",
|
||||
"config_v.py",
|
||||
]
|
||||
|
||||
# 循环当前目录下的py文件
|
||||
|
||||
view_tuple = set()
|
||||
for i in os.listdir(mainDir):
|
||||
if i not in excludeList and i[-5:] == "_v.py":
|
||||
viewName = i[:-3] # 去掉.py后缀字符串
|
||||
view_tuple.add("from main import {}".format(viewName))
|
||||
|
||||
# 组合成import字符串
|
||||
import_str = '\n'.join(view_tuple)
|
||||
# print(import_str)
|
||||
exec(import_str)
|
||||
|
||||
for i in os.listdir(mainDir):
|
||||
if i not in excludeList and i[-5:] == "_v.py":
|
||||
tableName = i[:-5]
|
||||
tableName = tableName.replace(" ", "").strip()
|
||||
print("tableName============>", tableName, len(tableName))
|
||||
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'{}/register'.format(tableName.lower()),
|
||||
eval("{}_v.{}_register".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/login'.format(tableName.lower()),
|
||||
eval("{}_v.{}_login".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/logout'.format(tableName.lower()),
|
||||
eval("{}_v.{}_logout".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/resetPass'.format(tableName.lower()),
|
||||
eval("{}_v.{}_resetPass".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/session'.format(tableName.lower()),
|
||||
eval("{}_v.{}_session".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/default'.format(tableName.lower()),
|
||||
eval("{}_v.{}_default".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/page'.format(tableName.lower()),
|
||||
eval("{}_v.{}_page".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/autoSort'.format(tableName.lower()),
|
||||
eval("{}_v.{}_autoSort".format(tableName.capitalize(), tableName.lower()))),
|
||||
|
||||
path(r'{}/save'.format(tableName.lower()),
|
||||
eval("{}_v.{}_save".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/add'.format(tableName.lower()),
|
||||
eval("{}_v.{}_add".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/thumbsup/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_thumbsup".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/info/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_info".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/detail/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_detail".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/update'.format(tableName.lower()),
|
||||
eval("{}_v.{}_update".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/delete'.format(tableName.lower()),
|
||||
eval("{}_v.{}_delete".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/vote/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_vote".format(tableName.capitalize(), tableName.lower()))),
|
||||
]
|
||||
)
|
||||
|
||||
# examrecord特定接口
|
||||
if tableName.lower() == "examrecord":
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'{}/groupby'.format(tableName.lower()),
|
||||
eval("{}_v.{}_groupby".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/deleteRecords'.format(tableName.lower()),
|
||||
eval("{}_v.{}_deleterecords".format(tableName.capitalize(), tableName.lower()))),
|
||||
]
|
||||
)
|
||||
|
||||
# forum特定接口
|
||||
if tableName.lower() == "forum":
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'{}/flist'.format(tableName.lower()),
|
||||
eval("{}_v.{}_flist".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/list/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_list_id".format(tableName.capitalize(), tableName.lower()))),
|
||||
]
|
||||
)
|
||||
else:
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'{}/list'.format(tableName.lower()),
|
||||
eval("{}_v.{}_list".format(tableName.capitalize(), tableName.lower()))),
|
||||
]
|
||||
)
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'cal/<str:tableName>/<str:columnName>', schema_v.schemaName_cal),
|
||||
path(r'file/download', schema_v.schemaName_file_download),
|
||||
path(r'file/upload', schema_v.schemaName_file_upload),
|
||||
path(r'follow/<tableName>/<columnName>/<level>/<parent>', schema_v.schemaName_follow_level),
|
||||
path(r'follow/<tableName>/<columnName>', schema_v.schemaName_follow),
|
||||
path(r'location', schema_v.schemaName_location),
|
||||
path(r'matchFace', schema_v.schemaName_matchface),
|
||||
path(r'option/<tableName>/<columnName>', schema_v.schemaName_option),
|
||||
path(r'remind/<tableName>/<columnName>/<type>', schema_v.schemaName_remind_tablename_columnname_type),
|
||||
# 前台提醒接口(通用接口,不需要登陆)
|
||||
path(r'<tableName>/remind/<columnName>/<type>', schema_v.schemaName_tablename_remind_columnname_type),
|
||||
# 后台提醒接口 (每个表的单独接口,需登录)
|
||||
path(r'sh/<tableName>', schema_v.schemaName_sh),
|
||||
path(r'upload/<fileName>', schema_v.schemaName_upload),
|
||||
path(r'group/<tableName>/<columnName>', schema_v.schemaName_group_quyu),
|
||||
path(r'value/<tableName>/<xColumnName>/<yColumnName>', schema_v.schemaName_value_quyu),
|
||||
]
|
||||
)
|
||||
|
||||
# print(urlpatterns)
|
@ -0,0 +1,22 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
from django.db import models
|
||||
|
||||
from .model import BaseModel
|
||||
|
||||
|
||||
class users(BaseModel):
|
||||
# id=models.BigIntegerField(verbose_name="自增id")
|
||||
username = models.CharField(max_length=100, verbose_name=u'账号')
|
||||
password = models.CharField(max_length=100, verbose_name=u'密码')
|
||||
role = models.CharField(max_length=100, verbose_name=u'角色')
|
||||
addtime = models.DateTimeField(auto_now_add=False, verbose_name=u'创建时间')
|
||||
__tablename__ = 'users'
|
||||
|
||||
class Meta:
|
||||
db_table = 'users'
|
||||
verbose_name = verbose_name_plural = u'管理员表'
|
||||
|
||||
# def __str__(self):
|
||||
# return self.username
|
@ -0,0 +1,161 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
from django.http import JsonResponse
|
||||
|
||||
from .users_model import users
|
||||
from util.codes import *
|
||||
from util.auth import Auth
|
||||
import util.message as mes
|
||||
|
||||
|
||||
def users_login(request):
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {'code': normal_code, "msg": mes.normal_code}
|
||||
req_dict = request.session.get("req_dict")
|
||||
if req_dict.get('role')!=None:
|
||||
del req_dict['role']
|
||||
datas = users.getbyparams(users, users, req_dict)
|
||||
if not datas:
|
||||
msg['code'] = password_error_code
|
||||
msg['msg'] = mes.password_error_code
|
||||
return JsonResponse(msg)
|
||||
|
||||
req_dict['id'] = datas[0].get('id')
|
||||
return Auth.authenticate(Auth, users, req_dict)
|
||||
|
||||
|
||||
def users_register(request):
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {'code': normal_code, "msg": mes.normal_code}
|
||||
req_dict = request.session.get("req_dict")
|
||||
|
||||
error = users.createbyreq(users, users, req_dict)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_session(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code,"msg":mes.normal_code, "data": {}}
|
||||
|
||||
req_dict = {"id": request.session.get('params').get("id")}
|
||||
msg['data'] = users.getbyparams(users, users, req_dict)[0]
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_logout(request):
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {
|
||||
"msg": "退出成功",
|
||||
"code": 0
|
||||
}
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_page(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code,
|
||||
"data": {"currPage": 1, "totalPage": 1, "total": 1, "pageSize": 10, "list": []}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
tablename = request.session.get("tablename")
|
||||
try:
|
||||
__hasMessage__ = users.__hasMessage__
|
||||
except:
|
||||
__hasMessage__ = None
|
||||
if __hasMessage__ and __hasMessage__ != "否":
|
||||
|
||||
if tablename != "users":
|
||||
req_dict["userid"] = request.session.get("params").get("id")
|
||||
if tablename == "users":
|
||||
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
|
||||
msg['data']['pageSize'] = users.page(users, users, req_dict)
|
||||
else:
|
||||
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
|
||||
msg['data']['pageSize'] = [],1,0,0,10
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_info(request, id_):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
data = users.getbyid(users, users, int(id_))
|
||||
if len(data) > 0:
|
||||
msg['data'] = data[0]
|
||||
# 浏览点击次数
|
||||
try:
|
||||
__browseClick__ = users.__browseClick__
|
||||
except:
|
||||
__browseClick__ = None
|
||||
|
||||
if __browseClick__ and "clicknum" in users.getallcolumn(users, users):
|
||||
click_dict = {"id": int(id_), "clicknum": str(int(data[0].get("clicknum", 0)) + 1)}
|
||||
ret = users.updatebyparams(users, users, click_dict)
|
||||
if ret != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = ret
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_save(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
error = users.createbyreq(users, users, req_dict)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_update(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
if req_dict.get("mima") and req_dict.get("password"):
|
||||
if "mima" not in users.getallcolumn(users,users):
|
||||
del req_dict["mima"]
|
||||
if "password" not in users.getallcolumn(users,users):
|
||||
del req_dict["password"]
|
||||
try:
|
||||
del req_dict["clicknum"]
|
||||
except:
|
||||
pass
|
||||
error = users.updatebyparams(users, users, req_dict)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_delete(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
|
||||
error = users.deletes(users,
|
||||
users,
|
||||
req_dict.get("ids")
|
||||
)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dj2.settings")
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
@ -0,0 +1,5 @@
|
||||
django==2.0
|
||||
django-threadlocals
|
||||
pymysql
|
||||
click
|
||||
requests
|
After Width: | Height: | Size: 332 KiB |
@ -0,0 +1 @@
|
||||
cnpm install
|
@ -0,0 +1 @@
|
||||
cnpm run serve
|
@ -0,0 +1 @@
|
||||
cnpm run build
|
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 4.2 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue