Skip to content

Commit b22a80a

Browse files
committed
添加json_serializer
1 parent 6c4e848 commit b22a80a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## 开发说明
88

9-
1. 修改`build.sh``docker-compose.yml`中镜像版本,执行`build.sh`构建镜像
9+
1. 修改`build.sh``docker-compose.yml`中镜像版本,执行`sh build.sh`构建镜像
1010
2. 执行`docker-compose up -d`启动容器
1111
3. 执行`docker exec -it flask-api-demo bash`进入容器
1212
4. 执行`supervisorctl stop app`停止服务,并执行`flask run``python wsgi.py`进入开发者模式

src/app/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
# @Author : llc
33
# @Time : 2020/5/4 15:57
4+
import json
45
import os
56
from datetime import timedelta
67

@@ -30,6 +31,9 @@
3031
SQLALCHEMY_TRACK_MODIFICATIONS = False
3132
# SQLALCHEMY_DATABASE_URI = SQLITE_DB_URI
3233
SQLALCHEMY_DATABASE_URI = DB_URI
34+
SQLALCHEMY_ENGINE_OPTIONS = {
35+
"json_serializer": lambda obj: json.dumps(obj, ensure_ascii=False)
36+
}
3337
# -------------------数据库配置-------------------
3438

3539

0 commit comments

Comments
 (0)