功能变化: 初始化优化

treebeard
李强 2022-05-17 09:23:36 +08:00
parent 4177c03abb
commit e8404ba8b9
5 changed files with 15 additions and 38552 deletions

1
backend/.gitignore vendored
View File

@ -96,3 +96,4 @@ conf/
db.sqlite3
media/
__pypackages__/
package-lock.json

View File

@ -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,8 +89,9 @@ def refresh_dictionary():
:return:
"""
if is_tenants_mode():
from django_tenants.utils import schema_context
with schema_context(connection.tenant.schema_name):
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,8 +103,9 @@ def refresh_system_config():
:return:
"""
if is_tenants_mode():
from django_tenants.utils import schema_context
with schema_context(connection.tenant.schema_name):
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()

View File

@ -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(

2
web/.gitignore vendored
View File

@ -1,7 +1,7 @@
.DS_Store
node_modules
/dist
package-lock.json
# local env files
.env.local
.env.*.local

38540
web/package-lock.json generated

File diff suppressed because it is too large Load Diff