Skip to content

Commit

Permalink
feat: 基础依赖调整 --story=119806440
Browse files Browse the repository at this point in the history
  • Loading branch information
normal-wls committed Sep 23, 2024
1 parent a6872ae commit 634517f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Base
Django==3.2.15
PyMySQL==0.6.7
mysqlclient==2.0.3
pymysql==1.0.2
requests==2.25.1
httplib2==0.19.0
Mako==1.1.4
Expand Down Expand Up @@ -61,7 +60,7 @@ importlib-metadata==3.7.3
protobuf==3.19.4

# blueapps
blueapps[opentelemetry,bkcrypto]==4.8.0
blueapps[opentelemetry,bkcrypto]==4.14.0
whitenoise==5.2.0
raven==6.5.0
python-json-logger==2.0.1
Expand Down
23 changes: 13 additions & 10 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,27 @@

import os

import pymysql

pymysql.install_as_MySQLdb()

# V3判断环境的环境变量为BKPAAS_ENVIRONMENT
if 'BKPAAS_ENVIRONMENT' in os.environ:
ENVIRONMENT = os.getenv('BKPAAS_ENVIRONMENT', 'dev')
if "BKPAAS_ENVIRONMENT" in os.environ:
ENVIRONMENT = os.getenv("BKPAAS_ENVIRONMENT", "dev")
# V2判断环境的环境变量为BK_ENV
else:
PAAS_V2_ENVIRONMENT = os.environ.get('BK_ENV', 'development')
PAAS_V2_ENVIRONMENT = os.environ.get("BK_ENV", "development")
ENVIRONMENT = {
'development': 'dev',
'testing': 'stag',
'production': 'prod',
"development": "dev",
"testing": "stag",
"production": "prod",
}.get(PAAS_V2_ENVIRONMENT)
DJANGO_CONF_MODULE = 'config.{env}'.format(env=ENVIRONMENT)
DJANGO_CONF_MODULE = "config.{env}".format(env=ENVIRONMENT)

try:
_module = __import__(DJANGO_CONF_MODULE, globals(), locals(), ['*'])
_module = __import__(DJANGO_CONF_MODULE, globals(), locals(), ["*"])
except ImportError as e:
raise ImportError("Could not import config '%s' (Is it on sys.path?): %s"
% (DJANGO_CONF_MODULE, e))
raise ImportError("Could not import config '%s' (Is it on sys.path?): %s" % (DJANGO_CONF_MODULE, e))

for _setting in dir(_module):
if _setting == _setting.upper():
Expand Down

0 comments on commit 634517f

Please sign in to comment.