Обновить src/myapp/__init__.py

This commit is contained in:
2026-02-23 22:39:18 +03:00
parent 18f6f3d3f3
commit faef281034
+7 -5
View File
@@ -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():