Initialise Babel on application startup

This commit is contained in:
Gergely Polonkai 2018-06-29 10:38:18 +02:00
parent 61fe581df6
commit e5e93c60b3

View File

@ -17,6 +17,7 @@
import os import os
from flask import Flask, render_template from flask import Flask, render_template
from flask_babel import Babel
class CalendarSocialApp(Flask): class CalendarSocialApp(Flask):
@ -28,6 +29,7 @@ class CalendarSocialApp(Flask):
config_name = os.environ.get('ENV', config or 'dev') config_name = os.environ.get('ENV', config or 'dev')
self.config.from_pyfile(f'config_{config_name}.py', True) self.config.from_pyfile(f'config_{config_name}.py', True)
db.init_app(self) db.init_app(self)
babel = Babel(app=self)
app = CalendarSocialApp(__name__) app = CalendarSocialApp(__name__)