-
Notifications
You must be signed in to change notification settings - Fork 42
/
config.py
47 lines (34 loc) · 1.16 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os
from os.path import dirname, join, abspath
from sys import platform
import pytz
from loguru import logger
# 定位项目根目录
SERVER_DIR_PROJECT = dirname(__file__) if "win" in platform else abspath(".")
SERVER_PATH_README = join(SERVER_DIR_PROJECT, "README.md")
SERVER_PATH_DOCS = join(SERVER_DIR_PROJECT, "docs")
os.makedirs(SERVER_PATH_DOCS, exist_ok=True)
# 文件数据库 目录根
SERVER_DIR_DATABASE = join(SERVER_DIR_PROJECT, "database")
SERVER_DIR_STORAGE = join(SERVER_DIR_DATABASE, "storage")
SERVER_DIR_HISTORY = join(SERVER_PATH_DOCS, "history")
SERVER_PATH_STORAGE_MD = join(SERVER_DIR_STORAGE, "storage_{}.md")
SERVER_PATH_TOPIC = join(SERVER_DIR_DATABASE, "topic.yml")
# 服务器日志文件路径
SERVER_DIR_DATABASE_LOG = join(SERVER_DIR_DATABASE, "logs")
logger.add(
join(SERVER_DIR_DATABASE_LOG, "runtime.log"),
level="DEBUG",
rotation="1 day",
retention="20 days",
encoding="utf8",
)
logger.add(
join(SERVER_DIR_DATABASE_LOG, "error.log"),
level="ERROR",
rotation="1 week",
encoding="utf8",
)
# 时区
TIME_ZONE_CN = pytz.timezone("Asia/Shanghai")
TIME_ZONE_NY = pytz.timezone("America/New_York")