def create_app(self): """Create and return a testing flask app.""" app = create_app(TestConfig) self.twill = Twill(app, port=3000) return app
# -*- coding: utf-8 -*- import os from flask.ext.script import Manager from gevent.pywsgi import WSGIServer from sasuke import create_app from sasuke.user import User, UserDetail, ADMIN, USER, ACTIVE from werkzeug import generate_password_hash, check_password_hash app = create_app() manager = Manager(app) project_root_path = os.path.join(os.path.dirname(app.root_path)) @manager.command def run(port=55555): """Run local server.""" app.run(port=port) @manager.command def start(port=55555): """ Run as Gevent pywsgi """ from gevent import monkey monkey.patch_all() WSGIServer(listener=('0.0.0.0', int(port)), application=app).serve_forever() @manager.command def initdb(): """ 初始化数据,插入管理员admin,用户guest """ # 管理员admin