Добавлена очистка кэша pip
parent
bca541a42d
commit
4169b9a6b9
|
|
@ -25,6 +25,7 @@ COPY ./requirements.txt /code/requirements.txt
|
|||
COPY ./app /code/app
|
||||
|
||||
RUN python3.11 -m pip install --upgrade pip
|
||||
RUN python3.11 -m pip cache purge
|
||||
RUN echo Y | python3.11 -m pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import datetime
|
||||
import os
|
||||
|
||||
TIMESTAMP = datetime.datetime.now().strftime("%d-%m-%Y %H:%M:%S")
|
||||
LOG_FILE = "error_log.txt"
|
||||
|
||||
def write_to_log(error_message, log_file=LOG_FILE):
|
||||
"""
|
||||
Записывает ошибку в лог-файл с временной меткой
|
||||
"""
|
||||
with open(log_file, 'a', encoding='utf-8') as f:
|
||||
f.write(f"[{TIMESTAMP}] {error_message}\n")
|
||||
|
||||
def clear_to_log(log_file=LOG_FILE):
|
||||
"""
|
||||
Очищает лог-файл и записывает новую шапку
|
||||
"""
|
||||
with open(log_file, 'w', encoding='utf-8') as f:
|
||||
f.write(f'=== Лог ошибок создан в {TIMESTAMP} ===\n\n')
|
||||
Loading…
Reference in New Issue