功能变化: 初始化优化
parent
4177c03abb
commit
e8404ba8b9
|
@ -95,4 +95,5 @@ conf/
|
|||
!conf/env.example.py
|
||||
db.sqlite3
|
||||
media/
|
||||
__pypackages__/
|
||||
__pypackages__/
|
||||
package-lock.json
|
||||
|
|
|
@ -57,7 +57,7 @@ def init_dictionary():
|
|||
else:
|
||||
settings.DICTIONARY_CONFIG = _get_all_dictionary()
|
||||
print("初始化字典配置完成")
|
||||
except ProgrammingError as e:
|
||||
except Exception as e:
|
||||
print("请先进行数据库迁移!")
|
||||
return
|
||||
|
||||
|
@ -78,7 +78,7 @@ def init_system_config():
|
|||
else:
|
||||
settings.SYSTEM_CONFIG = _get_all_system_config()
|
||||
print("初始化系统配置完成")
|
||||
except ProgrammingError as e:
|
||||
except Exception as e:
|
||||
print("请先进行数据库迁移!")
|
||||
return
|
||||
|
||||
|
@ -89,9 +89,10 @@ def refresh_dictionary():
|
|||
:return:
|
||||
"""
|
||||
if is_tenants_mode():
|
||||
from django_tenants.utils import schema_context
|
||||
with schema_context(connection.tenant.schema_name):
|
||||
settings.DICTIONARY_CONFIG[connection.tenant.schema_name] = _get_all_dictionary()
|
||||
from django_tenants.utils import tenant_context, get_tenant_model
|
||||
for tenant in get_tenant_model().objects.filter():
|
||||
with tenant_context(tenant):
|
||||
settings.DICTIONARY_CONFIG[connection.tenant.schema_name] = _get_all_dictionary()
|
||||
else:
|
||||
settings.DICTIONARY_CONFIG = _get_all_dictionary()
|
||||
|
||||
|
@ -102,9 +103,10 @@ def refresh_system_config():
|
|||
:return:
|
||||
"""
|
||||
if is_tenants_mode():
|
||||
from django_tenants.utils import schema_context
|
||||
with schema_context(connection.tenant.schema_name):
|
||||
settings.SYSTEM_CONFIG[connection.tenant.schema_name] = _get_all_system_config()
|
||||
from django_tenants.utils import tenant_context, get_tenant_model
|
||||
for tenant in get_tenant_model().objects.filter():
|
||||
with tenant_context(tenant):
|
||||
settings.SYSTEM_CONFIG[connection.tenant.schema_name] = _get_all_system_config()
|
||||
else:
|
||||
settings.SYSTEM_CONFIG = _get_all_system_config()
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ from dvadmin.system.views.system_config import InitSettingsViewSet
|
|||
from dvadmin.utils.swagger import CustomOpenAPISchemaGenerator
|
||||
|
||||
# =========== 初始化系统配置 =================
|
||||
# dispatch.init_system_config()
|
||||
# dispatch.init_dictionary()
|
||||
dispatch.init_system_config()
|
||||
dispatch.init_dictionary()
|
||||
# =========== 初始化系统配置 =================
|
||||
|
||||
schema_view = get_schema_view(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
package-lock.json
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue