Exemplo n.º 1
0
def testapp(request):
    app = create_app('dicom_upload.settings.TestConfig', env='dev')
    client = app.test_client()

    db.app = app
    db.create_all()

    def teardown():
        db.session.remove()
        db.drop_all()

    request.addfinalizer(teardown)

    return client
Exemplo n.º 2
0
#!/usr/bin/env python

# stdlib
import os

# 3p
from flask.ext.script import Manager, Server
from flask.ext.script.commands import ShowUrls, Clean

# project
from dicom_upload import create_app
from dicom_upload.models import db

env = os.environ.get('APPNAME_ENV', 'dev')
app = create_app('dicom_upload.settings.%sConfig' % env.capitalize(), env=env)

manager = Manager(app)
manager.add_command("server", Server())
manager.add_command("show-urls", ShowUrls())
manager.add_command("clean", Clean())


@manager.shell
def make_shell_context():
    """ Creates a python REPL with several default imports
        in the context of the app
    """
    return dict(app=app, db=db)


@manager.command