Example #1
0
def app():
    """Create and configure a new app instance for each test."""
    # create the app with common test config
    _app = create_app({
        'TESTING': True,
        'DEBUG': True,
    })

    # create the database and load test data
    with _app.app_context():
        init_db()

    yield _app
def app():
    """Return Flask app object."""
    return create_app()
Example #3
0
from rest_api import create_app
from rest_api.config import DevConfig

app = create_app(DevConfig)

print('debug ->', app.url_map)

# @app.route('/<string:id>')
# class HelloWorld(Resource):
#     def get(self, id):
#         return {id: '321'}
Example #4
0
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand, Config
from rest_api.models import User
from rest_api import create_app, db

app = create_app('config')
manager = Manager(app)  # 创建脚本的管理对象
Migrate(app, db)  # 让迁移和app和db建立管理
manager.add_command('db', MigrateCommand)  # 将数据库的迁移脚本添加到manager

if __name__ == '__main__':

    manager.run()
Example #5
0
from rest_api import create_app

app = create_app()