Skip to content

Commit 9f3bc40

Browse files
committed
Add files via upload
1 parent 3dcfe8c commit 9f3bc40

File tree

839 files changed

+2954365
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

839 files changed

+2954365
-0
lines changed

code/A10website/.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/A10website/.idea/A10website.iml

+32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/A10website/.idea/inspectionProfiles/profiles_settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/A10website/.idea/misc.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/A10website/.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import pymysql
2+
pymysql.install_as_MySQLdb()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

code/A10website/A10website/asgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for A10website project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'A10website.settings')
15+
16+
application = get_asgi_application()
+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
"""
2+
Django settings for A10website project.
3+
4+
Generated by 'django-admin startproject' using Django 3.0.3.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.0/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/3.0/ref/settings/
11+
"""
12+
13+
import os
14+
15+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = '#nd)jtnjz1=6uxn7sswhdb(5rm_m%%118+is(zciaso#@rpn=k'
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = ['*']
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = [
34+
'django.contrib.admin',
35+
'django.contrib.auth',
36+
'django.contrib.contenttypes',
37+
'django.contrib.sessions',
38+
'django.contrib.messages',
39+
'django.contrib.staticfiles',
40+
'rest_framework',
41+
'rest_framework.authtoken',
42+
'imagekit',
43+
'django_filters',
44+
'Index',
45+
'ent_manage',
46+
'user',
47+
'search',
48+
'searchTip',
49+
'clusterSearch',
50+
'riskSearch',
51+
'entInfo',
52+
'dataTojson',
53+
'batchSearch',
54+
'statistic',
55+
'upload'
56+
]
57+
58+
MIDDLEWARE = [
59+
'django.middleware.security.SecurityMiddleware',
60+
'django.contrib.sessions.middleware.SessionMiddleware',
61+
'django.middleware.common.CommonMiddleware',
62+
# 'django.middleware.csrf.CsrfViewMiddleware',
63+
'django.contrib.auth.middleware.AuthenticationMiddleware',
64+
'django.contrib.messages.middleware.MessageMiddleware',
65+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
66+
'utils.cors.CORSMiddleware'
67+
]
68+
69+
70+
ROOT_URLCONF = 'A10website.urls'
71+
72+
TEMPLATES = [
73+
{
74+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
75+
'DIRS': [os.path.join(BASE_DIR,"templates")],
76+
'APP_DIRS': True,
77+
'OPTIONS': {
78+
'context_processors': [
79+
'django.template.context_processors.debug',
80+
'django.template.context_processors.request',
81+
'django.contrib.auth.context_processors.auth',
82+
'django.contrib.messages.context_processors.messages',
83+
],
84+
},
85+
},
86+
]
87+
88+
WSGI_APPLICATION = 'A10website.wsgi.application'
89+
90+
91+
# Database
92+
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
93+
94+
DATABASES = {
95+
'default': {
96+
'ENGINE': 'django.db.backends.mysql', # 或者使用 mysql.connector.django
97+
'NAME': 'entdb',
98+
'USER': 'root',
99+
'PASSWORD': 'Zjut123456!',
100+
'HOST':'localhost',
101+
'PORT':'3306',
102+
}
103+
}
104+
105+
106+
# Password validation
107+
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
108+
109+
AUTH_PASSWORD_VALIDATORS = [
110+
{
111+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
112+
},
113+
{
114+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
115+
},
116+
{
117+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
118+
},
119+
{
120+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
121+
},
122+
]
123+
124+
125+
# Internationalization
126+
# https://docs.djangoproject.com/en/3.0/topics/i18n/
127+
128+
LANGUAGE_CODE = 'en-us'
129+
130+
TIME_ZONE = 'UTC'
131+
132+
USE_I18N = True
133+
134+
USE_L10N = True
135+
136+
USE_TZ = True
137+
138+
139+
# Static files (CSS, JavaScript, Images)
140+
# https://docs.djangoproject.com/en/3.0/howto/static-files/
141+
142+
STATIC_URL = '/static/'
143+
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
144+
145+
146+
147+
REST_FRAMEWORK = {
148+
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
149+
'DEFAULT_AUTHENTICATION_CLASSES': (
150+
'rest_framework.authentication.BasicAuthentication',
151+
'rest_framework.authentication.SessionAuthentication',
152+
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
153+
),
154+
'EXCEPTION_HANDLER': 'user.utils.custom_exception_handler',
155+
}
156+
157+
158+
AUTH_USER_MODEL = 'user.UserProfile'
159+
160+
import datetime
161+
JWT_AUTH = {
162+
163+
'JWT_EXPIRATION_DELTA': datetime.timedelta(days=1),# token的有效期
164+
'JWT_ISSUER': 'http://A10.A10',
165+
'JWT_AUTH_HEADER_PREFIX': 'TOKEN',
166+
'JWT_ALLOW_REFRESH': True,
167+
'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=1),
168+
'JWT_RESPONSE_PAYLOAD_HANDLER': 'user.utils.jwt_response_payload_handler',
169+
'JWT_RESPONSE_PAYLOAD_ERROR_HANDLER': 'user.views.jwt_response_payload_error_handler',
170+
}
171+
172+
APPEND_SLASH=True
173+
174+

code/A10website/A10website/urls.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""A10website URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/3.0/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+
"""
16+
from django.conf.urls import url
17+
from django.contrib import admin
18+
from django.urls import path,include
19+
from rest_framework.documentation import include_docs_urls
20+
from rest_framework_jwt.views import obtain_jwt_token
21+
from django.conf import settings
22+
from django.conf.urls.static import static
23+
24+
25+
urlpatterns = [
26+
# path('admin/', admin.site.urls),
27+
path('docs',include_docs_urls(title='A10')),
28+
path('api-auth/',include('rest_framework.urls')),
29+
url(r'^api/bfx/user/', include('user.urls')),
30+
url(r'^api/bfx/search/', include('search.urls')),
31+
url(r'^api/bfx/searchTip/', include('searchTip.urls')),
32+
url(r'^api/bfx/search/cluster', include('clusterSearch.urls')),
33+
url(r'^api/bfx/info/', include('entInfo.urls')),
34+
url(r'^api/bfx/info/basic', include('entInfo.urls')),
35+
url(r'^api/bfx/upload', include('upload.urls')),
36+
url(r'^api/bfx/statistic/', include('statistic.urls')),
37+
url(r'^api/bfx/test', include('train.urls')),
38+
url(r'^api/bfx/dbupload', include('dbpredict.urls')),
39+
]+ static(settings.STATIC_URL, document_root = settings.STATIC_ROOT)

code/A10website/A10website/wsgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for A10website project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'A10website.settings')
15+
16+
application = get_wsgi_application()

code/A10website/clusterSearch/__init__.py

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

code/A10website/clusterSearch/apps.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ClustersearchConfig(AppConfig):
5+
name = 'clusterSearch'

code/A10website/clusterSearch/migrations/__init__.py

Whitespace-only changes.
Binary file not shown.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

0 commit comments

Comments
 (0)