|
|
|
@ -1,8 +1,8 @@
@@ -1,8 +1,8 @@
|
|
|
|
|
from config import Config |
|
|
|
|
import os |
|
|
|
|
import logging |
|
|
|
|
|
|
|
|
|
from logging.handlers import SMTPHandler |
|
|
|
|
from logging.handlers import RotatingFileHandler |
|
|
|
|
import os |
|
|
|
|
|
|
|
|
|
from flask import Flask |
|
|
|
|
from flask_bootstrap import Bootstrap |
|
|
|
@ -11,19 +11,28 @@ from flask_migrate import Migrate
@@ -11,19 +11,28 @@ from flask_migrate import Migrate
|
|
|
|
|
from flask_login import LoginManager |
|
|
|
|
from flask_moment import Moment |
|
|
|
|
|
|
|
|
|
from config import Config |
|
|
|
|
|
|
|
|
|
app = Flask(__name__) |
|
|
|
|
app.config.from_object(Config) |
|
|
|
|
bootstrap = Bootstrap(app) |
|
|
|
|
db = SQLAlchemy(app) |
|
|
|
|
migrate = Migrate(app, db) |
|
|
|
|
login = LoginManager(app) |
|
|
|
|
db = SQLAlchemy() |
|
|
|
|
bootstrap = Bootstrap() |
|
|
|
|
migrate = Migrate() |
|
|
|
|
login = LoginManager() |
|
|
|
|
login.login_view = 'login' |
|
|
|
|
moment = Moment(app) |
|
|
|
|
login.login_message = 'Please log in to access this page.' |
|
|
|
|
moment = Moment() |
|
|
|
|
|
|
|
|
|
from app import routes, models, errors |
|
|
|
|
def create_app(config_class=Config): |
|
|
|
|
# pylint: disable=no-member |
|
|
|
|
app = Flask(__name__) |
|
|
|
|
app.config.from_object(config_class) |
|
|
|
|
|
|
|
|
|
db.init_app(app) |
|
|
|
|
bootstrap.init_app(app) |
|
|
|
|
migrate.init_app(app, db) |
|
|
|
|
login.init_app(app) |
|
|
|
|
moment.init_app(app) |
|
|
|
|
|
|
|
|
|
if not app.debug and not app.testing: |
|
|
|
|
if not app.debug and not app.testing: |
|
|
|
|
if app.config['MAIL_SERVER']: |
|
|
|
|
auth = None |
|
|
|
|
if app.config['MAIL_USERNAME'] or app.config['MAIL_PASSWORD']: |
|
|
|
@ -57,3 +66,7 @@ if not app.debug and not app.testing:
@@ -57,3 +66,7 @@ if not app.debug and not app.testing:
|
|
|
|
|
|
|
|
|
|
app.logger.setLevel(logging.INFO) |
|
|
|
|
app.logger.info('Microblog startup') |
|
|
|
|
|
|
|
|
|
return app |
|
|
|
|
|
|
|
|
|
from app import routes, models, errors |
|
|
|
|