Created
February 8, 2014 03:24
-
-
Save hersonls/8876229 to your computer and use it in GitHub Desktop.
Flask: Blueprint example
This file contains 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
from flask import Blueprint | |
from urls import url_rules | |
bp = Blueprint(__name__.split('.')[1], __name__, template_folder='templates') | |
for url_rule in url_rules: | |
url_regex, view_func = url_rule | |
bp.add_url_rule(url_regex, view_func=view_func, methods=['GET', 'POST']) |
This file contains 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
from views import index | |
from views import register | |
url_rules = ( | |
('/', index), | |
('/register/', register) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment