Exemplo n.º 1
0
def create_app():
    flask_app = TemplateBlueprint("web", __name__)
    url = get_router(flask_app, __name__)

    url('/', 'index')

    return flask_app
Exemplo n.º 2
0
# -*- coding: utf-8 -*-

from flask_apputils.routing import get_router, APIBlueprint

web = APIBlueprint('api', __name__)


def log(f):
    def wrapper(*args, **kwargs):
        print "log params: %s" % args
        return f(*args, **kwargs)

    return wrapper


route = get_router(web, __name__, filters=[log])

route('/user', 'user')
route('/student', 'student')


def user():
    return dict(name='John', age=32)


def student():
    return dict(name='Ama', form=3)
Exemplo n.º 3
0
# -*- coding: utf-8 -*-

from flask_apputils.routing import get_router, TemplateBlueprint

web = TemplateBlueprint("web", __name__)
route = get_router(web, __name__)

route("/", "index")
route("/home", "home")


def index():
    return "Index Page"


def home():
    return "Home Page"
Exemplo n.º 4
0
# -*- coding: utf-8 -*-

from flask_apputils.routing import get_router, TemplateBlueprint

web = TemplateBlueprint('web', __name__)
route = get_router(web, __name__)

route('/', 'index')
route('/home', 'home')


def index():
    return "Index Page"


def home():
    return "Home Page"
Exemplo n.º 5
0
# -*- coding: utf-8 -*-

from flask_apputils.routing import get_router, APIBlueprint

web = APIBlueprint('api', __name__)


def log(f):
    def wrapper(*args, **kwargs):
        print "log params: %s" % args
        return f(*args, **kwargs)
    return wrapper

route = get_router(web, __name__, filters=[log])

route('/user', 'user')
route('/student', 'student')


def user():
    return dict(name='John', age=32)


def student():
    return dict(name='Ama', form=3)