Ejemplo n.º 1
0
def show_methods():
    app = get_app(settings.Config, extensions=[socket])
    seen = []
    for route in app.url_map.iter_rules():
        if not route in seen:
            print route.rule, route.methods
            seen.append(route)
Ejemplo n.º 2
0
def main():
    app = get_app(settings.Config)
    if os.environ.get('REFRESH_DB'):
        #models.BaseMixin.engine.echo = True
        refresh_db(app,models,seed)
    app.debug = True
    socket.init_app(app)
    sio = socketio.Server()
    app.wsgi_app = socketio.Middleware(sio, app.wsgi_app)
    return app
Ejemplo n.º 3
0
def refresh_db(app=None,models=None,seed=None):
    if app is None:
        from flask_tasks import get_app,settings
        app = get_app(settings.TestConfig,add_default_extensions=False)
    if models is None:
        from flask_tasks import models
    if seed is None:
        from seed import seed

    ctx = app.test_request_context()
    ctx.push()
    
    models.BaseMixin.metadata.bind = models.BaseMixin.engine
    models.BaseMixin.engine.echo = True      
    models.BaseMixin.metadata.drop_all()
    models.BaseMixin.metadata.create_all()
    seed()

    ctx.pop()
Ejemplo n.º 4
0
def blueprints():
    print get_app(settings.Config, extensions=[socket]).blueprints.keys()
Ejemplo n.º 5
0
def show_ext():
    print get_app(settings.Config, extensions=[socket]).extensions.keys()
Ejemplo n.º 6
0
from flask_script import Manager, commands
from flask_tasks import get_app, settings
from flask import current_app
from flask_tasks.messages import socket

create_app = lambda: get_app(settings.Config, extensions=[socket])
manager = Manager(app=create_app)


manager.add_command("urls", commands.ShowUrls())


@manager.command
def show_ext():
    print get_app(settings.Config, extensions=[socket]).extensions.keys()


@manager.command
def show_methods():
    app = get_app(settings.Config, extensions=[socket])
    seen = []
    for route in app.url_map.iter_rules():
        if not route in seen:
            print route.rule, route.methods
            seen.append(route)


@manager.command
def blueprints():
    print get_app(settings.Config, extensions=[socket]).blueprints.keys()