Skip to content

Commit c72f624

Browse files
committed
减少依赖
1 parent 37fe780 commit c72f624

File tree

4 files changed

+23
-109
lines changed

4 files changed

+23
-109
lines changed

fast_tmp/conf/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import importlib
2+
import logging
23
import os
34
import sys
45
from typing import Any, Dict, List, Optional, Union
@@ -8,6 +9,7 @@
89
from fast_tmp.utils.db import init_model
910

1011
FASTAPI_VARIABLE = "FASTAPI_SETTINGS_MODULE"
12+
logger = logging.Logger(__file__)
1113

1214

1315
class Settings(BaseSettings):
@@ -43,12 +45,10 @@ def assemble_cors_origins(cls, v: Union[str, List[str]]) -> Union[List[str], str
4345
# 额外的配置信息
4446
EXTRA_SETTINGS: Dict[str, Any] = {}
4547

46-
class Config:
47-
case_sensitive = True
48-
env_file = ".env"
49-
5048
def __init__(self):
5149
super(Settings, self).__init__()
50+
if not self.FASTAPI_SETTINGS_MODULE:
51+
logger.warning("envirment FASTAPI_SETTINGS_MODULE is null")
5252
try:
5353
workdir = os.getcwd() # 把工作路径加入到代码执行里面
5454
for path in sys.path:

poetry.lock

Lines changed: 19 additions & 96 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ fastapi = "^0.85.0"
1818
python-jose = "^3.3.0"
1919
asgiref = "^3.5.2"
2020
tortoise-orm = "^0.19.2"
21-
python-dotenv = "^0.21.0"
22-
orjson = "^3.8.0"
2321
python-multipart = "^0.0.5"
2422

2523
[tool.poetry.dev-dependencies]

tests/test_example/test_example/settings.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import os
22
from typing import List
33

4-
import dotenv
5-
6-
dotenv.load_dotenv()
7-
8-
# import sentry_sdk
9-
# from sentry_sdk.integrations.redis import RedisIntegration
10-
114
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
125
SECRET_KEY = "awdfawfqergqreef"
136

0 commit comments

Comments
 (0)