Esempio n. 1
0
def test_production_config():
    """Production config."""
    app = create_app(ProdConfig)
    assert app.config['ENV'] == 'prod'
    assert app.config['DEBUG'] is False
    assert app.config['DEBUG_TB_ENABLED'] is False
    assert app.config['ASSETS_DEBUG'] is False
def app():
    _app = create_app(TestConfig)
    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
Esempio n. 3
0
def app():
    _app = create_app(TestConfig)
    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
Esempio n. 4
0
def app():
    """Create application for the tests."""
    _app = create_app("tests.settings")
    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
Esempio n. 5
0
def app():
    """An application for the tests."""
    _app = create_app(TestConfig)
    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
def test_dev_config():
    app = create_app(DevConfig)
    assert app.config['ENV'] == 'dev'
    assert app.config['DEBUG'] is True
    assert app.config['ASSETS_DEBUG'] is True
Esempio n. 7
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask_script import Manager, Shell, Server
from flask_script.commands import Clean, ShowUrls
from flask_migrate import MigrateCommand

from myflaskapp.app import create_app
from myflaskapp.models.user import User
from myflaskapp.settings import DevConfig, ProdConfig
from myflaskapp.database import db

if os.environ.get("MYFLASKAPP_ENV") == 'prod':
    app = create_app(ProdConfig)
else:
    app = create_app(DevConfig)

HERE = os.path.abspath(os.path.dirname(__file__))
TEST_PATH = os.path.join(HERE, 'tests')

manager = Manager(app)


def _make_context():
    """Return context dict for a shell session so you can access
    app, db, and the User model by default.
    """
    return {'app': app, 'db': db, 'User': User}


@manager.command
Esempio n. 8
0
def test_dev_config():
    app = create_app(DevConfig)
    assert app.config['ENV'] == 'dev'
    assert app.config['DEBUG'] is True
    assert app.config['ASSETS_DEBUG'] is True
Esempio n. 9
0
def test_dev_config():
    """Development config."""
    app = create_app(DevConfig)
    assert app.config['ENV'] == 'dev'
    assert app.config['DEBUG'] is True
Esempio n. 10
0
# -*- coding: utf-8 -*-
import os
from myflaskapp.app import celery, create_app
"""
start celery with:
	celery worker -A celery_worker.celery --loglevel=info
"""
app = create_app(os.getenv('FLASK_CONFIG'))
app.app_context().push()
Esempio n. 11
0
from flask_script import Command, Manager, Option, Server, Shell
from flask_script.commands import Clean, ShowUrls
from myflaskapp.app import create_app
from myflaskapp.database import db
from myflaskapp.settings import DevConfig, ProdConfig
from myflaskapp.dashboard.models import User
from myflaskapp.parking.utils import AddFlaskUser, SeedDatabaseWithGEOJSONSeed, \
    CrossReferenceAndBuildCrossLinks, CreateAdmin

CONFIG = ProdConfig if os.environ.get(
    'MYFLASKAPP_ENV'
) == 'prod' else DevConfig  #config environment variable prod, DevConfig
HERE = os.path.abspath(os.path.dirname(__file__))
TEST_PATH = os.path.join(HERE, 'tests')

app = create_app(CONFIG)  #call create app and pass the chosen config
manager = Manager(app)  #initialize flask_script manager and pass it the app
migrate = Migrate(app, db)  #db migration script for schema changes


def _make_context():
    """Return context dict for a shell session so you can access app, db, and the User model by default."""
    return {'app': app, 'db': db, 'User': User}


@manager.command
def test():
    """Run the tests."""
    import pytest
    exit_code = pytest.main([TEST_PATH, '--verbose'])
    return exit_code
Esempio n. 12
0
# -*- coding: utf-8 -*-
"""Create an application instance."""
from myflaskapp.app import create_app

app = create_app()
Esempio n. 13
0
from flask_migrate import Migrate, MigrateCommand
from flask_script import Command, Manager, Option, Server, Shell
from flask_script.commands import Clean, ShowUrls

from myflaskapp.app import create_app
from myflaskapp.database import db
from myflaskapp.settings import DevConfig, ProdConfig
from myflaskapp.user.models import User
from myflaskapp.user.utils import AddFlaskUser, SeedDatabaseWithGEOJSONSeed, \
    CrossReferenceAndBuildCrossLinks, CreateAdmin

CONFIG = ProdConfig if os.environ.get('MYFLASKAPP_ENV') == 'prod' else DevConfig
HERE = os.path.abspath(os.path.dirname(__file__))
TEST_PATH = os.path.join(HERE, 'tests')

app = create_app(CONFIG)
manager = Manager(app)
migrate = Migrate(app, db)


def _make_context():
    """Return context dict for a shell session so you can access app, db, and the User model by default."""
    return {'app': app, 'db': db, 'User': User}


@manager.command
def test():
    """Run the tests."""
    import pytest
    exit_code = pytest.main([TEST_PATH, '--verbose'])
    return exit_code
Esempio n. 14
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from myflaskapp import models
from myflaskapp.app import create_app
from myflaskapp.models import db

env = os.environ.get("MYFLASKAPP_ENV", 'prod')
app = create_app("myflaskapp.settings.{0}Config"
                    .format(env.capitalize()), env)

manager = Manager(app)
TEST_CMD = "nosetests"

def _make_context():
    '''Return context dict for a shell session so you can access
    app, db, and models by default.
    '''
    return {'app': app, 'db': db, 'models': models}

@manager.command
def test():
    '''Run the tests.'''
    status = subprocess.call(TEST_CMD, shell=True)
    sys.exit(status)

@manager.command
def createdb():
Esempio n. 15
0
# -*- coding: utf-8 -*-
"""Create an application instance."""
from flask.helpers import get_debug_flag

from myflaskapp.app import create_app
from myflaskapp.settings import DevConfig, ProdConfig

CONFIG = DevConfig if get_debug_flag() else ProdConfig

app = create_app(CONFIG)  # pylint: disable=invalid-name