Is Flask_Babel supported by PythonAnywhere?
I get an error while loading the website when it passes the locale_selector
This is a part of my code:
from flask import Flask, render_template,request
from flask_babel import Babel, gettext
app = Flask(__name__)
babel = Babel(app)
def get_locale():
return request.accept_languages.best_match(['en','nl','fr','de'])
babel.init_app(app, locale_selector=get_locale)
The error comes at the last line here above on the "locale_selector" variable.
Error message in log:
Error running WSGI application
2024-08-18 18:48:20,899: TypeError: Babel.init_app() got an unexpected keyword argument 'locale_selector'
2024-08-18 18:48:20,899: File "/var/www/kevinkrueger_pythonanywhere_com_wsgi.py", line 16, in <module>
2024-08-18 18:48:20,899: from KevinKruger import app as application # noqa
2024-08-18 18:48:20,900:
2024-08-18 18:48:20,900: File "/home/kevinkrueger/mysite/KevinKruger.py", line 15, in <module>
2024-08-18 18:48:20,900: babel.init_app(app, locale_selector=get_locale)
It does work perfect on my local laptop. Thanks Wim
[edit by admin: formatting]