Created
November 1, 2013 05:32
-
-
Save svieira/7261308 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
from flask import Flask, Blueprint | |
app = Flask(__name__) | |
bp = Blueprint(__name__, "bp") | |
@bp.route("/test") | |
def test(): | |
return "BP.test" | |
@bp.route("/subpath/<path:anything>") | |
def star_route(anything=None): | |
return "BP.star_route. Path: {}".format(anything) | |
@bp.route("/<controller>/<action>/<argument>") | |
def mvc(controller, action, argument): | |
return "BP.mvc: {}.{}({})".format(controller, action, argument) | |
@bp.route("/<path:missing>") | |
def error_handler(missing): | |
return "BP.missing: {}".format(missing) | |
app.register_blueprint(bp) | |
if __name__ == "__main__": | |
app.debug = True | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment