# -*- coding: utf-8 -*- menus = (('pos_simulate', u'模拟操作', 'grup_alarm'), ) ####### 自定义视图 ######### import routes from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./apps/pos/templates/')
# -*- coding: utf-8 -*- ####### Crud 初始化 ####### from mocrud.api import setup,uncheck import models setup(models) uncheck() ####### 自定义视图 ######### import routes from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./crud_example/templates/')
<pre>{{repr(e.exception)}}</pre> %end %if DEBUG and e.traceback: <h2>Traceback:</h2> <pre>{{e.traceback}}</pre> %end '} %except ImportError: <b>ImportError:</b> Could not generate the error page. Please add mole to sys.path %end """ from mole.const import TEMPLATE_PATH cur = os.path.split(os.path.realpath(__file__))[0] templates_path = os.path.join(cur, 'templates') TEMPLATE_PATH.append(templates_path) # 配置静态目录 from mole import route, static_file static_path = os.path.join(cur, 'static') @route('/static_mosys/:filename#.*#', name='mosys.static') def admin_static(filename): return static_file(filename, root=static_path) @route('/tmpfile/:file#.*#') #导出供下载的目录 def media(file): return static_file(file, root='./tmpfile')
# -*- coding: utf-8 -*- from mole import route, static_file #安装的子应用 apps_list = ( ('personnel',u'人事管理'), ('att',u'考勤管理'), ('crud_example',u'模型管理') ) # 配置公共模板目录 from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./apps/templates/') # 配置静态目录 @route('/static/:file#.*#') def media(file): return static_file(file, root='./apps/media') @route('/media/:file#.*#') def media(file): return static_file(file, root='./apps/media') # 配置系统app COOKIE_KEY = '457rxK8ytkKiqkfqwfoiQS@kaJSFOo8h' from mole.mole import default_app app = default_app() # 安装公共路由视图 import routes
<pre>{{repr(e.exception)}}</pre> %end %if DEBUG and e.traceback: <h2>Traceback:</h2> <pre>{{e.traceback}}</pre> %end '} %except ImportError: <b>ImportError:</b> Could not generate the error page. Please add mole to sys.path %end """ from mole.const import TEMPLATE_PATH cur = os.path.split(os.path.realpath(__file__))[0] templates_path = os.path.join(cur,'templates') TEMPLATE_PATH.append(templates_path) # 配置静态目录 from mole import route,static_file static_path = os.path.join(cur,'static') @route('/static_mosys/:filename#.*#',name='mosys.static') def admin_static(filename): return static_file(filename, root=static_path) @route('/tmpfile/:file#.*#') #导出供下载的目录 def media(file): return static_file(file, root='./tmpfile') ####################### 全局初始化 #######################
# -*- coding: utf-8 -*- menus = (('att_report', u'报表数据', 'grup_info'), ) ####### 自定义视图 ######### import routes from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./apps/att/templates/')
# -*- coding: utf-8 -*- menus = (('aboutEmp', u'菜单组一', 'grup_chat'), ('baseinfo', u'菜单组二', 'grup_chart'), ('reportEmp', u'菜单组二', 'grup_disc')) ####### 自定义视图 ######### import routes from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./apps/crud_example/templates/')
<pre>{{str(e.output)}}</pre> %if DEBUG and e.exception: <h2>Exception:</h2> <pre>{{repr(e.exception)}}</pre> %end %if DEBUG and e.traceback: <h2>Traceback:</h2> <pre>{{e.traceback}}</pre> %end '} %except ImportError: <b>ImportError:</b> Could not generate the error page. Please add mole to sys.path %end """ from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./lib/mosys/templates/') from mole import route,static_file # 配置静态目录 @route('/tmpfile/:file#.*#') def media(file): return static_file(file, root='./tmpfile') ####################### 全局初始化 ####################### #加载全局模型对象 from load import ModelScan ModelScan() #引入路由视图 import route_func
##################### 系统环境设置 ####################### def set_lib_path(): import sys import os sys.path.append('./lib') sys.path.append('../../../python-support') #os.environ["PYTHONPATH"]='../' set_lib_path() #安装的mosys、apps系统模块 import apps import mosys from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./apps/templates/') TEMPLATE_PATH.append('./lib/mosys/templates/') #安装的PyRedisAdmin import PyRedisAdmin.routes import serverM.routes TEMPLATE_PATH.append('./lib/PyRedisAdmin/templates/') #加入SessionMiddleware 中间件 COOKIE_KEY = '457rxK8ytkKiqkfqwfoiQS@kaJSFOo8h' from mole.mole import default_app from mole.sessions import SessionMiddleware app = default_app() app = SessionMiddleware(app=app, cookie_key=COOKIE_KEY, no_datastore=True) #运行服务器
# -*- coding: utf-8 -*- ##################### 系统环境设置 ####################### def set_lib_path(): import sys import os sys.path.append('./mole_libs') set_lib_path() from mole import route,static_file from mole.mole import default_app # 加载app import pywebsv import demo # 配置模板目录 from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./pywebsv/templates/') # 配置静态目录 @route('/rpc_static/:file#.*#') def rpc_media(file): return static_file(file, root='./pywebsv/static') app = default_app() # 运行服务器 from mole import run if __name__ == "__main__": run(app=app,host='0.0.0.0', port=8081)
# -*- coding: utf-8 -*- ''' crud ''' __version__ = "0.1" from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./lib/mocrud/templates/') import apps as conf from mole import static_file @conf.app.route('/static_crud/:filename#.*#',name='admin.static') def admin_static(filename): return static_file(filename, root='./lib/mocrud/static') #from db import Database #from apps import crud_db_config #db = Database(crud_db_config)
import sys import os sys.path.append('./mole_libs') set_lib_path() from mole import route, static_file from mole.mole import default_app # 加载app import pywebsv import demo # 配置模板目录 from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./pywebsv/templates/') # 配置静态目录 @route('/rpc_static/:file#.*#') def rpc_media(file): return static_file(file, root='./pywebsv/static') app = default_app() # 运行服务器 from mole import run if __name__ == "__main__": run(app=app, host='0.0.0.0', port=8081)
# -*- coding: utf-8 -*- menus = ( ('att_monitor',u'数据监控', 'grup_disc'), # ('aboutEmp',u'人员相关', 'grup_info'), # ('baseinfo',u'基本资料', 'grup_alarm'), # ('reportEmp',u'人事报表', 'grup_disc'), ) from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./apps/personnel/templates/')
# -*- coding: utf-8 -*- menus = ( ('att_monitor',u'数据监控', 'grup_disc'), ('aboutEmp',u'人事调动', 'grup_info'), ) from mole.const import TEMPLATE_PATH TEMPLATE_PATH.append('./apps/personnel/templates/')