librelist archives

« back to archive

Registering blueprints makes url_for not use preferred url scheme

Registering blueprints makes url_for not use preferred url scheme

From:
Mark Steve Samson
Date:
2012-07-26 @ 13:21
> from flask import Flask, Blueprint, url_for
> 
> app = Flask(__name__)
> blueprint = Blueprint('blueprint', __name__)
> 
> @blueprint.route('/')
> def index():
>   return url_for('.index', _external=True)
> 
> app.register_blueprint(blueprint)
> 
> app.config.update(
>   SERVER_NAME='localhost:5000',
>   PREFERRED_URL_SCHEME='https',
> )
> 
> app.run()
 
`url_for` here returns "http://localhost:5000/"

Not sure if this is an issue or I'm doing something wrong so I posted it here.