Example #1
0
"""Script for initializing your database.

Note that dropping your existing tables is an opt-in operation.
If you want to drop tables before you create tables, set an environment
variable called "DEVELOPMENT" to be "True".
"""
import os

from flask_todo import create_app, db
from flask_todo.models.task import TaskModel
from flask_todo.models.user import UserModel

app = create_app('development')

db.app = app

if bool(os.environ.get('DEVELOPMENT', '')):
    db.drop_all()
db.create_all()
Example #2
0
def app():
    app = create_app({
        'TESTING': True,
    })

    yield app
Example #3
0
def test_config():
    assert not create_app().testing
    assert create_app({'TESTING': True}).testing
Example #4
0
# run.py

import os

# local imports
from flask_todo import create_app

config_name = os.environ.get('FLASK_CONFIG', 'development')

app = create_app(config_name)

if __name__ == "__main__":
    app.run()
Example #5
0
def app():
    app = create_app({
        'Testing': True,
    })

    yield app