diff options
Diffstat (limited to 'talermerchantdemos/blog/blog.py')
-rw-r--r-- | talermerchantdemos/blog/blog.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/talermerchantdemos/blog/blog.py b/talermerchantdemos/blog/blog.py index 7112b33..ba6571b 100644 --- a/talermerchantdemos/blog/blog.py +++ b/talermerchantdemos/blog/blog.py @@ -61,6 +61,7 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__)) app = flask.Flask( __name__, template_folder=BASE_DIR, static_folder=BASE_DIR + "/../static/" ) +app.debug = True app.secret_key = base64.b64encode(os.urandom(64)).decode("utf-8") LOGGER = logging.getLogger(__name__) @@ -81,7 +82,8 @@ babel = Babel(app) print("Using translations from:") print(list(babel.translation_directories)) translations = [str(translation) for translation in babel.list_translations()] -translations.append('en') +if not 'en' in translations: + translations.append('en') print("Operating with the following translations available:") print(translations) @@ -126,6 +128,19 @@ def index(): target = flask.request.accept_languages.best_match(translations, default) return flask.redirect("/" + target + "/", code=302) +## +# Serve the /favicon.ico requests. +# +# @return the favicon.ico file. +@app.route("/favicon.ico") +def favicon(): + LOGGER.info("will look into: " + os.path.join(app.root_path, 'static')) + return flask.send_from_directory( + os.path.join(app.root_path, 'static'), + "favicon.ico", + mimetype="image/vnd.microsoft.ico" + ) + @babel.localeselector def get_locale(): parts = request.path.split('/', 2) |