def app(request): flask_app = create_app() flask_app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' flask_app.config['TESTING'] = True flask_app.config['WTF_CSRF_ENABLED'] = False flask_app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False flask_app.config['SERVER_NAME'] = 'cyber.local' with flask_app.app_context(): yield flask_app
# -*- coding: utf-8 -*- from flask.ext.script import Manager from tracker import create_app from tracker.models import User, Comment, Expense from tracker.extensions import db app = create_app() manager = Manager(app) @manager.command def run(): """Run in local machine.""" app.run(host='0.0.0.0', port=5029) @manager.command def initdb(): """Init/reset database.""" db.drop_all() db.create_all() manager.add_option('-c', '--config', dest="config", required=False,
# -*- coding: utf-8 -*- from flask.ext.script import Manager from tracker import create_app from tracker.models import User, Comment, Expense from tracker.extensions import db app = create_app() manager = Manager(app) @manager.command def run(): """Run in local machine.""" app.run(host='0.0.0.0',port=5029) @manager.command def initdb(): """Init/reset database.""" db.drop_all() db.create_all()
def create_app(self): """Create and return a testing flask app.""" app = create_app(TestConfig) # self.twill = Twill(app, port=3000) return app