Skip to content

Instantly share code, notes, and snippets.

@svieira
Created November 1, 2013 05:32
Show Gist options
  • Save svieira/7261308 to your computer and use it in GitHub Desktop.
Save svieira/7261308 to your computer and use it in GitHub Desktop.
#!/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