Some task is started in a separate process, where in an infinite loop you need to perform some actions and write the result to the database. During the first run of the loop, it runs and then throws an exception:
DatabaseError: the server is closed.
How to implement a record in the database in another process in Django?
_process = Process(target=start_process, args=(message,id)) _process.start() def start_process(message,id): while True: ... cursor = connection.cursor() cursor.execute("""UPDATE tasks SET exemplar=%s WHERE id_tsk=%s;""", [exemplar, id]) cursor.close() ... sleep(100)