pccs/app/pccs.py

40 lines
929 B
Python

"""
pccs — 算力中心集群系统 (Pooled Computing Cluster System)
入口: webapp(init) 模式
"""
import os, sys
from ahserver.webapp import webapp
from ahserver.serverenv import ServerEnv
from appbase.init import load_appbase
from rbac.init import load_rbac
WORKDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def get_module_dbname(m):
return 'pccs'
def password_encode(s):
if s is None:
return ''
from ahserver.globalEnv import password_encode as _orig
return _orig(s)
def init():
env = ServerEnv()
env.get_module_dbname = get_module_dbname
env.password_encode = password_encode
# monkey-patch ServerEnv class so ALL instances get these methods
ServerEnv.get_module_dbname = staticmethod(get_module_dbname)
ServerEnv.password_encode = staticmethod(password_encode)
load_appbase()
load_rbac()
if __name__ == '__main__':
webapp(init)