Python-telegram-bot in django application
I’m trying to start
python-telegram-bot in a web application with the django framework. To do this, I follow any example from the Telegram library and end up calling the method
application.run_polling(). I know it’s not the best option because this blocks my web server, and I want to replace it with a better one, but I can’t find it.
According to official documentation, there is a tip that indicates the following:
When combining python-telegram-bot with other asyncio based frameworks, using this method is likely not the best choice, as it blocks the event loop until it receives a stop signal as described above. Instead, you can manually call the methods listed below to start and shut down the application and the updater. Keeping the event loop running and listening for a stop signal is then up to you.
And then I find the following section:
initialize(), start(), stop(), shutdown() telegram.ext.Updater.start_polling(), telegram.ext.Updater.stop(), run_webhook()
I’ve tried to understand the methods in the list, but I can’t figure out how to run
python-telegram-bot in the background and not affect my main server.
Are there any links or documents that expand the information or detail the steps to follow in these cases?
Thank you in advance