-
-
Save enlore/80bf02346d6cabcba5b1 to your computer and use it in GitHub Desktop.
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 Flask, Blueprint, redirect, url_for | |
### pages blueprint | |
pages = Blueprint('pages', __name__) | |
@pages.route('/') | |
def index(): | |
return 'pages index' | |
### user blueprint | |
user = Blueprint('user', __name__) | |
@user.route('/login') | |
def login(): | |
return redirect(url_for('pages.index')) | |
### thuh app | |
app = Flask(__name__) | |
app.register_blueprint(user) | |
app.register_blueprint(pages) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when you use
url_for('pages.index')
which pages?pages = Blueprint('pages', name)
^^^^^^ (or) ^^^^^
P.S. I landed here from http://stackoverflow.com/questions/19208488/using-url-for-across-blueprints
I am also having similar issue with blueprinting