Skip to content

Commit 15730e4

Browse files
authored
Merge pull request #70 from nineaiyu/dev
chore: 升级依赖, 优化数据库引擎配置
2 parents e52802c + 057cb1c commit 15730e4

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nineaiyu/xadmin-server-base:20241117_124832 AS stage-build
1+
FROM nineaiyu/xadmin-server-base:20241128_080516 AS stage-build
22
ARG VERSION
33

44
WORKDIR /data/xadmin-server

common/core/middleware.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ def process_view(self, request, view_func, view_args, view_kwargs):
119119
return
120120

121121
def process_request(self, request):
122+
if request.path == '/api/common/api/health':
123+
return
122124
self.__handle_request(request)
123125

124126
def process_response(self, request, response):
@@ -127,6 +129,8 @@ def process_response(self, request, response):
127129
:param response:
128130
:return:
129131
"""
132+
if request.path == '/api/common/api/health':
133+
return response
130134
show = False
131135
if self.enable:
132136
if self.methods == 'ALL' or request.method in self.methods:

demo/serializers/book.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ class Meta:
5353
}
5454

5555
# # 该方法定义了管理字段,和 extra_kwargs 定义的 admin 含义一样,该字段会被序列化为
56+
# # 定义带有关联关系的字段,比如上面的admin,则额外参数中,input_type 和 attrs 至少存在一个,要不然前端可能会解析失败
5657
# # { "pk": 2, "username": "admin", "label": "admin(2)" }
57-
# # attrs 变量,表示展示的字段,有 pk,username 字段
58+
# # attrs 变量,表示展示的字段,有 pk,username 字段, 且 pk 字段是必须的, 比如 'attrs': ['pk']
5859
# # format 变量,表示label字段展示内容,里面的字段一定是属于 attrs 定义的字段,写错的话,可能会报错
5960
# # queryset 变量, 表示数据查询对象集合,注意:search-columns 方法中,该字段会有个 choices 变量,并且包含所有queryset数据,
6061
# # 如果数据量特别大的时候,一定要自定义 input_type, 否则会有问题

requirements.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ django==5.1.3
22
djangorestframework==3.15.2
33
django-cors-headers==4.6.0
44
django-filter==24.3
5-
mysqlclient==2.2.5
5+
mysqlclient==2.2.6
66
psycopg2-binary==2.9.10
77
django-redis==5.4.0
88
pycryptodomex==3.21.0
@@ -15,14 +15,14 @@ python-daemon==3.1.0
1515
gunicorn==23.0.0
1616
django-proxy==1.3.0
1717
psutil==6.1.0
18-
uvicorn==0.32.0
18+
uvicorn==0.32.1
1919
daphne==4.1.2
20-
channels==4.1.0
21-
channels-redis==4.2.0
20+
channels==4.2.0
21+
channels-redis==4.2.1
2222
django-ranged-response==0.2.0
2323
user-agents==2.2.0
2424
aiofiles==24.1.0
25-
websockets==14.0
25+
websockets==14.1
2626
django-imagekit==5.0.0
2727
pilkit==3.0
2828
drf-spectacular==0.27.2
@@ -34,9 +34,9 @@ chardet==5.2.0
3434
pyexcel==0.7.1
3535
pyexcel-xlsx==0.6.0
3636
alibabacloud-dysmsapi20170525==3.1.0
37-
phonenumbers==8.13.49
37+
phonenumbers==8.13.50
3838
pycountry==24.6.1
39-
geoip2==4.8.0
39+
geoip2==4.8.1
4040
ipip-ipdb==1.6.1
4141
requests==2.32.3
4242
html2text==2024.2.26

server/settings/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,14 @@
156156

157157
DB_OPTIONS = {}
158158
DB_ENGINE = CONFIG.DB_ENGINE.lower()
159+
if DB_ENGINE in ['mysql', 'oracle', 'postgresql', 'sqlite3']:
160+
ENGINE = 'django.db.backends.{}'.format(DB_ENGINE)
161+
else:
162+
ENGINE = CONFIG.DB_ENGINE
163+
159164
DATABASES = {
160165
'default': {
161-
'ENGINE': 'django.db.backends.{}'.format(DB_ENGINE),
166+
'ENGINE': ENGINE,
162167
'NAME': CONFIG.DB_DATABASE,
163168
'HOST': CONFIG.DB_HOST,
164169
'PORT': CONFIG.DB_PORT,

0 commit comments

Comments
 (0)