Beispiel #1
0
    def setUp(self):
        # patch where the object is looked up rather than defined
        self.patch = patch('app.resources.redis_client')
        # run.create_app() also uses redis - we need to start patching here
        self.mocked_redis = self.patch.start()

        # initialize app with testing config
        _app = run.create_app("app.config.TestingConfig")
        self.client = _app.test_client()
Beispiel #2
0
from app import run

from base64 import b64encode
from flask.helpers import get_debug_flag

from app.settings import DevConfig
from app.settings import ProductionConfig

CONFIG = DevConfig if get_debug_flag() else ProductionConfig

app = run.create_app(CONFIG)
app.jinja_env.filters['b64d'] = lambda u: b64encode(u).decode()
Beispiel #3
0
activate_this = '/var/www/mangarso.com/env/bin/activate_this.py'
with open(activate_this) as file_:
    exec(file_.read(), dict(__file__=activate_this))

from app.run import create_app
from app.extensions import celery

app = create_app()

if __name__ == '__main__':
    with app.app_context():
        celery.start()
Beispiel #4
0
from app.run import create_app

app = create_app({})

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=5000)
Beispiel #5
0
def _make_context():
    return dict(app=create_app(config.dev_config),
                db=db,
                populate_db=populate_db)
Beispiel #6
0
from flask_migrate import Migrate, MigrateCommand
from flask_script import (
    Server,
    Shell,
    Manager,
    prompt_bool,
)


def _make_context():
    return dict(app=create_app(config.dev_config),
                db=db,
                populate_db=populate_db)


app = create_app(config=config.dev_config)

migrate = Migrate(app, db)

manager = Manager(app)
# Runs server from makefile command
manager.add_command('runserver', Server())
manager.add_command('shell', Shell(make_context=_make_context))
manager.add_command('db', MigrateCommand)


@manager.command
@manager.option('-n', '--num_users', help='Number of users')
def create_db(num_users=5):
    """Creates database tables and populates them."""
    db.create_all()