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