diff options
Diffstat (limited to 'talermerchantdemos/landing/landing.py')
-rw-r--r-- | talermerchantdemos/landing/landing.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/talermerchantdemos/landing/landing.py b/talermerchantdemos/landing/landing.py index ffbedd7..270e205 100644 --- a/talermerchantdemos/landing/landing.py +++ b/talermerchantdemos/landing/landing.py @@ -41,8 +41,7 @@ if not sys.version_info.major == 3 and sys.version_info.minor >= 6: ) sys.exit(1) -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) -app = flask.Flask(__name__, template_folder=BASE_DIR) +app = flask.Flask(__name__, template_folder="../templates", static_folder="../static") app.debug = True app.secret_key = base64.b64encode(os.urandom(64)).decode("utf-8") @@ -56,6 +55,8 @@ except ConfigurationError as ce: print(ce) exit(1) +BABEL_TRANSLATION_DIRECTORIES = "../translations" + app.config.from_object(__name__) babel = Babel(app) @@ -67,8 +68,7 @@ LOGGER.info( "Operating with the following translations available: " + " ".join(translations) ) -# pylint: disable=no-member -app.jinja_env.globals.update(self_localized=self_localized) +app.add_template_global(self_localized) @babel.localeselector @@ -113,7 +113,7 @@ def utility_processor(): @app.errorhandler(Exception) def internal_error(e): return flask.render_template( - "templates/error.html.j2", + "landing-error.html.j2", message=gettext("Internal error"), stack=traceback.format_exc(), lang=get_locale(), @@ -173,7 +173,7 @@ def start(lang): merchant_survey_url = "#" return flask.render_template( - "templates/index.html.j2", + "landing-index.html.j2", merchant_currency=CURRENCY, lang=lang, bank_url=bank_register_url, @@ -186,14 +186,14 @@ def start(lang): @app.errorhandler(404) def handler_404(e): return flask.render_template( - "templates/error.html.j2", message=gettext("Page not found"), lang=get_locale() + "landing-error.html.j2", message=gettext("Page not found"), lang=get_locale() ) @app.errorhandler(405) def handler_405(e): return flask.render_template( - "templates/error.html.j2", + "landing-error.html.j2", message=gettext("HTTP method not allowed for this page"), lang=get_locale(), ) |