fix: deploy fixes - db on ServerEnv, bricks symlink, dspy entcms->cms, config paths, init_data
This commit is contained in:
parent
ae06dda9da
commit
7f5f5ac10d
@ -2,6 +2,7 @@
|
|||||||
Portal全局函数 — 注册到ServerEnv供.dspy和.ui调用
|
Portal全局函数 — 注册到ServerEnv供.dspy和.ui调用
|
||||||
"""
|
"""
|
||||||
from ahserver.serverenv import ServerEnv
|
from ahserver.serverenv import ServerEnv
|
||||||
|
from appPublic.jsonConfig import getConfig
|
||||||
|
|
||||||
def get_module_dbname(mname):
|
def get_module_dbname(mname):
|
||||||
"""Portal应用统一使用ocai_cms数据库"""
|
"""Portal应用统一使用ocai_cms数据库"""
|
||||||
@ -50,6 +51,7 @@ def UiMessage(title="消息", message="后台消息", timeout=5):
|
|||||||
|
|
||||||
def set_globalvariable():
|
def set_globalvariable():
|
||||||
g = ServerEnv()
|
g = ServerEnv()
|
||||||
|
g.getConfig = getConfig
|
||||||
g.get_module_dbname = get_module_dbname
|
g.get_module_dbname = get_module_dbname
|
||||||
g.UiError = UiError
|
g.UiError = UiError
|
||||||
g.UiMessage = UiMessage
|
g.UiMessage = UiMessage
|
||||||
|
|||||||
@ -44,6 +44,11 @@ def init():
|
|||||||
set_globalvariable()
|
set_globalvariable()
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
env.get_module_dbname = get_module_dbname
|
env.get_module_dbname = get_module_dbname
|
||||||
|
|
||||||
|
# Initialize DBPools and register db on ServerEnv for dspy use
|
||||||
|
config = getConfig('.')
|
||||||
|
env.db = DBPools(config.databases)
|
||||||
|
|
||||||
load_pybricks()
|
load_pybricks()
|
||||||
load_appbase()
|
load_appbase()
|
||||||
load_rbac()
|
load_rbac()
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"password_key":"!@#$%^&*(*&^%$QWERTYUIqwertyui234567",
|
"password_key": "!@#$%^&*(*&^%$QWERTYUIqwertyui234567",
|
||||||
"logger": {
|
"logger": {
|
||||||
"name": "portal",
|
"name": "portal",
|
||||||
"levelname": "info",
|
"levelname": "info",
|
||||||
@ -29,10 +29,6 @@
|
|||||||
[
|
[
|
||||||
"$[workdir]$/../cms/wwwroot",
|
"$[workdir]$/../cms/wwwroot",
|
||||||
"/cms"
|
"/cms"
|
||||||
],
|
|
||||||
[
|
|
||||||
"$[workdir]$/bricks",
|
|
||||||
"/bricks"
|
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"host": "0.0.0.0",
|
"host": "0.0.0.0",
|
||||||
@ -77,4 +73,4 @@
|
|||||||
"zh-Hans-CN": "zh-cn",
|
"zh-Hans-CN": "zh-cn",
|
||||||
"en-US": "en"
|
"en-US": "en"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ except ImportError:
|
|||||||
# 简单YAML解析(fallback)
|
# 简单YAML解析(fallback)
|
||||||
yaml = None
|
yaml = None
|
||||||
|
|
||||||
CMS_DIR = os.path.expanduser("~/repos/cms")
|
CMS_DIR = os.path.expanduser("~/cms")
|
||||||
DATA_FILE = os.path.join(CMS_DIR, "init", "data.yaml")
|
DATA_FILE = os.path.join(CMS_DIR, "init", "data.yaml")
|
||||||
|
|
||||||
def load_yaml_simple(path):
|
def load_yaml_simple(path):
|
||||||
@ -62,7 +62,7 @@ def main():
|
|||||||
|
|
||||||
# 初始化日志和配置
|
# 初始化日志和配置
|
||||||
MyLogger(getConfig())
|
MyLogger(getConfig())
|
||||||
db = DBPools()
|
db = DBPools(getConfig().databases)
|
||||||
dbname = 'ocai_cms'
|
dbname = 'ocai_cms'
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
config = getConfig('.')
|
config = getConfig('.')
|
||||||
DBPools(config.databases)
|
DBPools(config.databases)
|
||||||
dbname = get_module_dbname('entcms')
|
dbname = get_module_dbname('cms')
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
|
|
||||||
group = params_kw.get('group', None)
|
group = params_kw.get('group', None)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
config = getConfig('.')
|
config = getConfig('.')
|
||||||
DBPools(config.databases)
|
DBPools(config.databases)
|
||||||
dbname = get_module_dbname('entcms')
|
dbname = get_module_dbname('cms')
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
|
|
||||||
_id = params_kw.get('id', '')
|
_id = params_kw.get('id', '')
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
config = getConfig('.')
|
config = getConfig('.')
|
||||||
DBPools(config.databases)
|
DBPools(config.databases)
|
||||||
dbname = get_module_dbname('entcms')
|
dbname = get_module_dbname('cms')
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
|
|
||||||
content_type = params_kw.get('content_type', None)
|
content_type = params_kw.get('content_type', None)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
config = getConfig('.')
|
config = getConfig('.')
|
||||||
DBPools(config.databases)
|
DBPools(config.databases)
|
||||||
dbname = get_module_dbname('entcms')
|
dbname = get_module_dbname('cms')
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
|
|
||||||
ns = {'is_visible': '1', 'sort': 'sort_order asc'}
|
ns = {'is_visible': '1', 'sort': 'sort_order asc'}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
config = getConfig('.')
|
config = getConfig('.')
|
||||||
DBPools(config.databases)
|
DBPools(config.databases)
|
||||||
dbname = get_module_dbname('entcms')
|
dbname = get_module_dbname('cms')
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user