1 Star 0 Fork 3

liukaiok/rocket

forked from 秋枫zsp/rocket 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
config.py 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
秋枫zsp 提交于 2023-07-10 22:53 . 添加注释
import os
class Config(object):
MYSQL_HOST = "127.0.0.1"
MYSQL_USER = "root"
MYSQL_PWD = "123456"
MYSQL_PORT = 3306
DBNAME = "rocket"
SQLALCHEMY_DATABASE_URI = f"mysql+pymysql://{MYSQL_USER}:{MYSQL_PWD}@{MYSQL_HOST}:{MYSQL_PORT}/{DBNAME}"
SQLALCHEMY_TRACK_MODIFICATIONS = False
# token加密key和过期时间
TOKEN_KEY = "rocket"
TOKEN_EXPIRATION = 336
EXECUTOR_THREAD_POOL = 2
class FilePath(object):
ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) # ROOT_PATH
APP_PATH = os.path.join(ROOT_PATH, "app") # app 路径
LOG_FILE_PATH = os.path.join(ROOT_PATH, "logs") # 日志文件路径
if not os.path.isdir(LOG_FILE_PATH):
os.mkdir(LOG_FILE_PATH)
FILE_PATH = os.path.join(ROOT_PATH, "files") # 文件路径
if not os.path.isdir(FILE_PATH):
os.mkdir(FILE_PATH)
ROCKET_SERVER = os.path.join(LOG_FILE_PATH, "rocket_server.log")
# ROCKET_HTTP = os.path.join(LOG_FILE_PATH, "rocket_http.log")
ROCKET_ERROR = os.path.join(LOG_FILE_PATH, "rocket_error.log")
# 项目日志滚动配置(日志文件超过10 MB就自动新建文件扩充)
LOGGING_ROTATION = "10 MB"
# 项目日志配置
LOGGING_CONF = {
"server_handler": {
"file": FilePath.ROCKET_SERVER,
"level": "INFO",
"rotation": LOGGING_ROTATION,
"enqueue": True,
"backtrace": False,
"diagnose": False,
},
"error_handler": {
"file": FilePath.ROCKET_ERROR,
"level": "ERROR",
"rotation": LOGGING_ROTATION,
"enqueue": True,
"backtrace": True,
"diagnose": True,
}
}
ROCKET_ENV = os.environ.get("rocket_env", "dev")
BANNER = """
______ _____ _____ _ __ _____ _____
| ___ \| _ |/ __ \| | / /| ___||_ _|
| |_/ /| | | || / \/| |/ / | |__ | |
| / | | | || | | \ | __| | |
| |\ \ \ \_/ /| \__/\| |\ \| |___ | |
\_| \_| \___/ \____/\_| \_/\____/ \_/
"""
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/liukaiok/rocket.git
git@gitee.com:liukaiok/rocket.git
liukaiok
rocket
rocket
master

搜索帮助