Beispiel #1
0
import os.path as p

from subprocess import call, check_call
from pprint import pprint

from flask import current_app as app
from flask.ext.script import Server, Manager
from tabutils import fntools as ft

from app import create_app, db, models, utils


manager = Manager(create_app)
manager.add_option("-m", "--cfgmode", dest="config_mode", default="Development")
manager.add_option("-f", "--cfgfile", dest="config_file", type=p.abspath)
manager.main = manager.run  # Needed to do `manage <command>` from the cli


@manager.option("-h", "--host", help="The server host", default=None)
@manager.option("-p", "--port", help="The server port", default=None)
@manager.option("-t", "--threaded", help="Run multiple threads", action="store_true")
def runserver(**kwargs):
    # Overriding the built-in `runserver` behavior
    """Runs the flask development server"""

    with app.app_context():
        skwargs = {
            "host": kwargs.get("host") or app.config["HOST"],
            "port": kwargs.get("port") or app.config["PORT"],
            "threaded": kwargs.get("threaded"),
        }
Beispiel #2
0
import swutils
import config

from subprocess import call
from datetime import datetime as dt
from functools import partial

from flask import current_app as app
from flask.ext.script import Manager
from tabutils.process import merge

from app import create_app, create_db, utils, models, __title__

manager = Manager(create_app)
manager.add_option('-m', '--mode', default='Development')
manager.main = manager.run

_basedir = p.dirname(__file__)


@manager.command
def check():
    """Check staged changes for lint errors"""
    call(p.join(_basedir, 'bin', 'check-stage'), shell=True)


@manager.command
def lint():
    """Check style with flake8"""
    call('flake8', shell=True)
Beispiel #3
0
import swutils
import config

from subprocess import call
from datetime import datetime as dt
from functools import partial

from flask import current_app as app
from flask.ext.script import Manager
from tabutils.process import merge

from app import create_app, create_db, utils, models, __title__

manager = Manager(create_app)
manager.add_option('-m', '--mode', default='Development')
manager.main = manager.run

_basedir = p.dirname(__file__)


@manager.command
def check():
    """Check staged changes for lint errors"""
    call(p.join(_basedir, 'bin', 'check-stage'), shell=True)


@manager.command
def lint():
    """Check style with flake8"""
    call('flake8', shell=True)
Beispiel #4
0
from subprocess import call, check_call
from pprint import pprint

from flask import current_app as app
from flask.ext.script import Server, Manager
from tabutils import fntools as ft

from app import create_app, db, models, utils

manager = Manager(create_app)
manager.add_option('-m',
                   '--cfgmode',
                   dest='config_mode',
                   default='Development')
manager.add_option('-f', '--cfgfile', dest='config_file', type=p.abspath)
manager.main = manager.run  # Needed to do `manage <command>` from the cli


@manager.option('-h', '--host', help='The server host', default=None)
@manager.option('-p', '--port', help='The server port', default=None)
@manager.option('-t',
                '--threaded',
                help='Run multiple threads',
                action='store_true')
def runserver(**kwargs):
    # Overriding the built-in `runserver` behavior
    """Runs the flask development server"""

    with app.app_context():
        skwargs = {
            'host': kwargs.get('host') or app.config['HOST'],