Открыл админу изделия, доработал списание
All checks were successful
Deploy MES Core / deploy (push) Successful in 10s

This commit is contained in:
2026-04-07 12:57:43 +03:00
parent a238c83b04
commit 86215c9fa8
12 changed files with 206 additions and 23 deletions

View File

@@ -13,6 +13,8 @@ https://docs.djangoproject.com/en/6.0/ref/settings/
import os
from pathlib import Path
import environ
import logging
from logging.handlers import RotatingFileHandler
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@@ -178,6 +180,46 @@ STATICFILES_DIRS = [BASE_DIR / 'static']
MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR / 'media'
# Логирование (единый файл на сервер)
LOG_DIR = BASE_DIR / 'logs'
try:
os.makedirs(LOG_DIR, exist_ok=True)
except Exception:
pass
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'simple': {
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
},
},
'handlers': {
'mes_file': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'INFO',
'filename': str(LOG_DIR / 'mes.log'),
'maxBytes': 5 * 1024 * 1024,
'backupCount': 3,
'encoding': 'utf-8',
'formatter': 'simple',
},
'console': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'simple',
},
},
'loggers': {
'mes': {
'handlers': ['mes_file', 'console'],
'level': 'INFO',
'propagate': False,
},
},
}
# Куда переходим после логина
LOGIN_REDIRECT_URL = '/' # Куда идем после входа
LOGOUT_REDIRECT_URL = '/' # Куда идем после выхода