示例#1
0
    def setup(self):
        os.environ['MODE'] = 'TESTING'

        app = create_app()
        self.app = app

        self.client = app.test_client()

        with app.app_context():
            db.drop_all()
            db.create_all()
from xichuangzhu import create_app

app = create_app()
示例#3
0
# coding: utf-8
import os
import re
from werkzeug.security import gen_salt
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from fabric.api import run as fabrun, env
from xichuangzhu import create_app
from xichuangzhu.models import db, Work, Author, Dynasty, Quote
from xichuangzhu.utils import s2t

app = create_app()
manager = Manager(app)

# 添加migrate命令
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)


@manager.command
def run():
    """启动app"""
    app.run(debug=True)


@manager.command
def syncdb():
    """根据model创建数据库tables"""
    db.create_all()