W
Size: a a a
W
D
DT
W
W
D
VB
def get_logger(title: str, directory: str) -> logging.Logger:
logger = logging.getLogger(title)
filepath = f'{directory}logfile.log'
Path(directory).mkdir(parents=True, exist_ok=True)
Path(filepath).touch(exist_ok=True, mode=0o777)
file_handler = logging.FileHandler(filename=filepath)
file_handler.setLevel(LOGGING_LEVEL)
file_handler.setFormatter(logging.Formatter('{levelname} {asctime} {module} {message}', style='{'))
logger.addHandler(file_handler)
return logger
МП
VB
МП
VB
МП
VB
МП
МП
VB
D
1
django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
async def station_update(self, station):
station = await database_sync_to_async(WorkStation.objects.get(pk=station['id']))()
N