Обновить src/myapp/__init__.py
This commit is contained in:
@@ -7,6 +7,8 @@ import logging
|
|||||||
from flask import Flask
|
from flask import Flask
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
|
|
||||||
|
from myapp.core import config
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_object(config.CONFIG)
|
app.config.from_object(config.CONFIG)
|
||||||
@@ -15,12 +17,12 @@ app.config.from_envvar('FLASKR_SETTINGS', silent=True)
|
|||||||
|
|
||||||
# Логирование
|
# Логирование
|
||||||
handler = RotatingFileHandler(
|
handler = RotatingFileHandler(
|
||||||
app.config['LOG_FILE'],
|
config['LOG_FILE'],
|
||||||
maxBytes=app.config['LOG_FILE_SIZE']*1024*1024,
|
maxBytes=config['LOG_FILE_SIZE']*1024*1024,
|
||||||
backupCount=1
|
backupCount=1
|
||||||
)
|
)
|
||||||
handler.setLevel(logging.INFO)
|
handler.setLevel(logging.INFO)
|
||||||
formatter = logging.Formatter(app.config['LONG_LOG_FORMAT'])
|
formatter = logging.Formatter(config['LONG_LOG_FORMAT'])
|
||||||
handler.setFormatter(formatter)
|
handler.setFormatter(formatter)
|
||||||
app.logger.addHandler(handler)
|
app.logger.addHandler(handler)
|
||||||
|
|
||||||
@@ -32,8 +34,8 @@ from . import lib, models
|
|||||||
def inject_data():
|
def inject_data():
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
result['STATIC'] = app.config['STATIC']
|
result['STATIC'] = config['STATIC']
|
||||||
result['ITEMS_ON_PAGE'] = app.config['ITEMS_ON_PAGE']
|
result['ITEMS_ON_PAGE'] = config['ITEMS_ON_PAGE']
|
||||||
|
|
||||||
result['user'] = None
|
result['user'] = None
|
||||||
if lib.get_user():
|
if lib.get_user():
|
||||||
|
|||||||
Reference in New Issue
Block a user