S
S
Sasha2021-04-16 10:01:26
Django
Sasha, 2021-04-16 10:01:26

How to call a function on startup and shutdown?

Hello. Please tell me, I want to bind a telegram bot written with aiogram to Django. The bot works through webhooks. Since the bot is asynchronous, it works with the database not through django orm, but through tortoise-orm. How can I make it so that when Django starts, a method is called to open a connection to the database, and when it ends, a method is called to end work with the database.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question