def fill_db(): app = create_app('product') _context = app.app_context() _context.push() fill_post() fill_draft()
def init_db(): app = create_app("product") _context = app.app_context() _context.push() with closing(connect_db()) as db: with open("./summer/schema.sql", mode="r") as f: db.cursor().executescript(f.read()) db.commit()
def init_db(): app = create_app('product') _context = app.app_context() _context.push() with closing(connect_db()) as db: with open('./summer/schema.sql', mode='r') as f: db.cursor().executescript(f.read()) db.commit()
def setUp(self): self.app = create_app('test') self.app_context = self.app.app_context() self.app_context.push() self.db = get_db() with open('./summer/schema.sql', mode='r') as f: self.db.cursor().executescript(f.read()) self.db.commit()
# -*- coding: utf-8 -*- import sys reload(sys).setdefaultencoding("utf-8") from summer.app import create_app app = create_app("product") if __name__ == "__main__": app.run()
# -*- coding: utf-8 -*- from flask.ext.script import Manager from summer.app import create_app app = create_app('product') manager = Manager(app) @manager.command def web(): app.run() if __name__ == "__main__": manager.run()
# -*- coding: utf-8 -*- import sys reload(sys).setdefaultencoding('utf-8') from summer.app import create_app app = create_app() app.config['DEBUG'] = True if __name__ == '__main__': app.run()