app = multalisk.Multalisk(__name__) app.init_conf(APP_CONF, debug=DEBUG) class News_Report_ru(object): __metaclass__ = app.MetaSQL __modelid__ = "1001" __tablename__ = "report_test_tr_tr" id = orm.Column(orm.Integer, primary_key=True) news_id = orm.Column(orm.Integer) category = orm.Column(orm.Integer) priority = orm.Column(orm.Integer) source = orm.Column(orm.VARCHAR(128)) top_click = orm.Column(orm.Integer) recommend_click = orm.Column(orm.Integer) home_click = orm.Column(orm.Integer) push_click = orm.Column(orm.Integer) top_show = orm.Column(orm.Integer) recommend_show = orm.Column(orm.Integer) home_show = orm.Column(orm.Integer) push_show = orm.Column(orm.Integer) date = orm.Column(orm.VARCHAR(30)) objs = News_Report_ru.query print objs init_cache(host='127.0.0.1', port=6379) app.run(host='0.0.0.0', port=5002)
# -*- coding: utf-8 -*- import sys sys.path.append("../") from multalisk.cache import init_cache from model import app, news from api.test import test_api # extend api for multalisk app.create_api('/test', ['GET'], test_api) init_cache() if __name__ == "__main__": app.run(host='0.0.0.0')