1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00
ihatemoney_ynh/budget/run.py
Alexis Metaireau f61d1432c7 Translate the application using Flask-babel.
The only translation so far is french, but more can be added. The browser language
is used thanks to the HTTP languages headers.

There are still some problems with the translation of some strings, I don't know
why this is. See #12
2011-10-15 01:19:19 +02:00

33 lines
523 B
Python

from web import main, db, mail, babel
from api import api
import os
from flask import *
app = Flask(__name__)
app.config.from_object("default_settings")
app.register_blueprint(main)
app.register_blueprint(api)
# db
db.init_app(app)
db.app = app
db.create_all()
# mail
mail.init_app(app)
# translations
babel.init_app(app)
@babel.localeselector
def get_locale():
return request.accept_languages.best_match(['fr', 'en'])
def main():
app.run(host="0.0.0.0", debug=True)
if __name__ == '__main__':
main()