-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog.py
30 lines (24 loc) · 784 Bytes
/
blog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from flask import Flask, request
from app.config import Config
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_mail import Mail
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from flask_babel import Babel, lazy_gettext as _l
app = Flask(__name__)
login = LoginManager(app)
login.login_view = 'loginUser'
login.login_message = _l('Please log in to access this page.')
app.config.from_object(Config)
db = SQLAlchemy(app)
migrate = Migrate(app, db)
mail = Mail(app)
bootstrap = Bootstrap(app)
moment = Moment(app)
babel = Babel(app)
from app import routes, errors, models
@babel.localeselector
def get_locale():
return request.accept_languages.best_match(app.config['LANGUAGES'])