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

This commit is contained in:
2026-02-23 22:39:18 +03:00
parent 18f6f3d3f3
commit faef281034

View File

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