I have a trivial app where I'm trying to redirect the favicon per:
http://flask.pocoo.org/docs/0.10/patterns/favicon/
app = flask.Flask(__name__) app.add_url_rule('/favicon.ico', redirect_to=flask.url_for('static', filename='favicon.ico')) But this fails with:
RuntimeError: Attempted to generate a URL without the application context being pushed. This has to be executed when application context is available. So, guessing, I try this:
app = flask.Flask(__name__) with app.app_context(): flask.current_app.add_url_rule('/favicon.ico', redirect_to=flask.url_for('static', filename='favicon.ico')) But get a different error:
RuntimeError: Application was not able to create a URL adapter for request independent URL generation. You might be able to fix this by setting the SERVER_NAME config variable. What is going on?