1
+ """
2
+ Django settings for DoSites project.
3
+
4
+ Generated by 'django-admin startproject' using Django 4.0.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/4.0/topics/settings/
8
+
9
+ For the full list of settings and their values, see
10
+ https://docs.djangoproject.com/en/4.0/ref/settings/
11
+ """
12
+ import os .path
13
+ from pathlib import Path
14
+ import time
15
+
16
+ # Build paths inside the project like this: BASE_DIR / 'subdir'.
17
+ BASE_DIR = Path (__file__ ).resolve ().parent .parent
18
+
19
+ # Quick-start development settings - unsuitable for production
20
+ # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
21
+
22
+ # SECURITY WARNING: keep the secret key used in production secret!
23
+ SECRET_KEY = 'django-insecure-#^sp!k4c7g^xy-%or23j#=q++4p)ucfgz=p43!c1g=s&agzg6q'
24
+
25
+ # SECURITY WARNING: don't run with debug turned on in production!
26
+ DEBUG = True
27
+
28
+ ALLOWED_HOSTS = []
29
+
30
+ # Application definition
31
+
32
+ INSTALLED_APPS = [
33
+ # simpleui样式的后台页面
34
+ 'simpleui' ,
35
+
36
+ 'django.contrib.admin' ,
37
+ 'django.contrib.auth' ,
38
+ 'django.contrib.contenttypes' ,
39
+ 'django.contrib.sessions' ,
40
+ 'django.contrib.messages' ,
41
+ 'django.contrib.staticfiles' ,
42
+
43
+ # 门户网站的app模块
44
+ 'home' , # 首页
45
+ 'about' , # 简介
46
+ 'contact' , # 欢迎咨询
47
+ 'news' , # 新闻动态
48
+ 'products' , # 产品中心
49
+ 'service' , # 服务支持
50
+ 'science' , # 科研基地
51
+
52
+ # CRM系统的app模块
53
+ 'institution' , # 机构管理
54
+ 'customer' , # 客户管理
55
+ 'speaker' , # 讲者管理
56
+ 'jurisdiction' , # 辖区管理
57
+ 'supplier' , # 供应商管理
58
+ 'meeting' , # 会议管理
59
+ 'approve' , # 审批中心
60
+ 'system' , # 系统管理
61
+ 'forms' , # 报表中心
62
+
63
+ # 其他插件
64
+ 'DjangoUeditor' , # 富文本编辑器
65
+ 'widget_tweaks' , # 添加模型表单定制化渲染
66
+ ]
67
+
68
+ MIDDLEWARE = [
69
+ 'django.middleware.security.SecurityMiddleware' ,
70
+ 'django.contrib.sessions.middleware.SessionMiddleware' ,
71
+ 'django.middleware.common.CommonMiddleware' ,
72
+ 'django.middleware.csrf.CsrfViewMiddleware' ,
73
+ 'django.contrib.auth.middleware.AuthenticationMiddleware' ,
74
+ 'django.contrib.messages.middleware.MessageMiddleware' ,
75
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware' ,
76
+ ]
77
+
78
+ ROOT_URLCONF = 'DoSites.urls'
79
+
80
+ TEMPLATES = [
81
+ {
82
+ 'BACKEND' : 'django.template.backends.django.DjangoTemplates' ,
83
+ 'DIRS' : [os .path .join (BASE_DIR , 'templates' )], # 对于用了templates的,这个一定要设置,不然会报错TemplateDoesNotExist
84
+ 'APP_DIRS' : True ,
85
+ 'OPTIONS' : {
86
+ 'context_processors' : [
87
+ 'django.template.context_processors.debug' ,
88
+ 'django.template.context_processors.request' ,
89
+ 'django.contrib.auth.context_processors.auth' ,
90
+ 'django.contrib.messages.context_processors.messages' ,
91
+ ],
92
+ },
93
+ },
94
+ ]
95
+
96
+ WSGI_APPLICATION = 'DoSites.wsgi.application'
97
+
98
+ # Database
99
+ # https://docs.djangoproject.com/en/4.0/ref/settings/#databases
100
+
101
+ DATABASES = {
102
+ 'default' : {
103
+ 'ENGINE' : 'django.db.backends.mysql' ,
104
+ 'NAME' : 'dy_sites_dev' ,
105
+ 'HOST' : 'localhost' ,
106
+ 'POST' : '3306' ,
107
+ 'USER' : 'root' ,
108
+ 'PASSWORD' : 'Imaioscoder123.'
109
+ }
110
+ }
111
+
112
+ # Password validation
113
+ # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
114
+
115
+ AUTH_PASSWORD_VALIDATORS = [
116
+ {
117
+ 'NAME' : 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator' ,
118
+ },
119
+ {
120
+ 'NAME' : 'django.contrib.auth.password_validation.MinimumLengthValidator' ,
121
+ },
122
+ {
123
+ 'NAME' : 'django.contrib.auth.password_validation.CommonPasswordValidator' ,
124
+ },
125
+ {
126
+ 'NAME' : 'django.contrib.auth.password_validation.NumericPasswordValidator' ,
127
+ },
128
+ ]
129
+
130
+ # Internationalization
131
+ # https://docs.djangoproject.com/en/4.0/topics/i18n/
132
+
133
+ LANGUAGE_CODE = 'zh-Hans'
134
+
135
+ TIME_ZONE = 'Asia/Shanghai'
136
+
137
+ USE_I18N = True
138
+
139
+ USE_TZ = True
140
+
141
+ # Static files (CSS, JavaScript, Images)
142
+ # https://docs.djangoproject.com/en/4.0/howto/static-files/
143
+
144
+ STATIC_URL = 'static/'
145
+ STATICFILES_DIRS = (
146
+ os .path .join (BASE_DIR , "static" ),
147
+ )
148
+ # STATIC_ROOT = os.path.join(BASE_DIR, 'static') # 如果克隆报错提示找不到静态目录,请先在settings.py指定静态目录, clone成功后,注释掉,因为以上面STATICFILES_DIRS冲突,导致css不起效,影响显示
149
+
150
+ # Default primary key field type
151
+ # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
152
+
153
+ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
154
+
155
+ # 对图片的路径进行存储
156
+ MEDIA_URL = 'media/'
157
+ MEDIA_ROOT = os .path .join (BASE_DIR , "media" )
158
+
159
+ # 指定simpleui默认的主题,指定一个文件名,相对路径就从simpleui的theme目录读取
160
+ SIMPLEUI_DEFAULT_THEME = 'Green.css'
161
+ SIMPLEUI_DEFAULT_ICON = False
162
+ SIMPLEUI_LOGO = 'https://avatars2.githubusercontent.com/u/13655483?s=60&v=4'
163
+ SIMPLEUI_HOME_INFO = False
164
+ SIMPLEUI_HOME_QUICK = False
165
+ SIMPLEUI_HOME_ACTION = False
166
+ SIMPLEUI_ANALYSIS = False
167
+ SIMPLEUI_LOGIN_PARTICLES = False
168
+ SIMPLEUI_ICON = {
169
+ '公司简介' : 'fas fa-building' ,
170
+ '荣誉资质' : 'fas fa-trophy' ,
171
+ '新闻动态' : 'fas fa-newspaper' ,
172
+ '人才招聘' : 'fas fa-place-of-worship' ,
173
+ '招聘信息' : 'fab fa-ubuntu' ,
174
+ '简历信息' : 'fas fa-file' ,
175
+ '联系我们' : 'fas fa-network-wired' ,
176
+ '产品中心' : 'fab fa-product-hunt' ,
177
+ '产品列表' : 'fas fa-list-ol' ,
178
+ '服务支持' : 'fab fa-servicestack' ,
179
+ '文件资料' : 'far fa-folder-open' ,
180
+ }
181
+ SIMPLEUI_CONFIG = {
182
+ 'system_keep' : True ,
183
+ # 'menu_display': ['Simpleui', '测试', '权限认证', '动态菜单测试'], # 开启排序和过滤功能, 不填此字段为默认排序和全部显示, 空列表[] 为全部不显示.
184
+ 'dynamic' : True , # 设置是否开启动态菜单, 默认为False. 如果开启, 则会在每次用户登陆时动态展示菜单内容
185
+ 'menus' : [{
186
+ 'name' : 'Simpleui' ,
187
+ 'icon' : 'fas fa-code' ,
188
+ 'url' : 'https://gitee.com/tompeppa/simpleui'
189
+ }, {
190
+ 'app' : 'auth' ,
191
+ 'name' : '权限认证' ,
192
+ 'icon' : 'fas fa-user-shield' ,
193
+ 'models' : [{
194
+ 'name' : '用户' ,
195
+ 'icon' : 'fa fa-user' ,
196
+ 'url' : 'auth/user/'
197
+ }]
198
+ }, {
199
+ # 自2021.02.01+ 支持多级菜单,models 为子菜单名
200
+ 'name' : '多级菜单测试' ,
201
+ 'icon' : 'fa fa-file' ,
202
+ # 二级菜单
203
+ 'models' : [{
204
+ 'name' : 'Baidu' ,
205
+ 'icon' : 'far fa-surprise' ,
206
+ # 第三级菜单 ,
207
+ 'models' : [
208
+ {
209
+ 'name' : '爱奇艺' ,
210
+ 'url' : 'https://www.iqiyi.com/dianshiju/'
211
+ # 第四级就不支持了,element只支持了3级
212
+ }, {
213
+ 'name' : '百度问答' ,
214
+ 'icon' : 'far fa-surprise' ,
215
+ 'url' : 'https://zhidao.baidu.com/'
216
+ }
217
+ ]
218
+ }, {
219
+ 'name' : '内网穿透' ,
220
+ 'url' : 'https://www.wezoz.com' ,
221
+ 'icon' : 'fab fa-github'
222
+ }]
223
+ }, {
224
+ 'name' : '动态菜单测试' ,
225
+ 'icon' : 'fa fa-desktop' ,
226
+ 'models' : [{
227
+ 'name' : time .time (),
228
+ 'url' : 'http://baidu.com' ,
229
+ 'icon' : 'far fa-surprise'
230
+ }]
231
+ }]
232
+ }
0 commit comments