
On the other side, Laravel is one of the most popular framework to build web applications written in PHP. And also, Bot has been supported by lots of instant messaging service provider such as Telegram, Line, Facebook, etc. Will run your bot while you will be able to import Django Models and work with them inside that script.Chat bot’s popularity has been growing these past years because of it’s great functionality and reliability to handle some cases in business. $ DJANGO_SETTINGS_MODULE=ttings telegram_bot.py So, create a separate Python script (for example, telegram_bot.py in the root of your app) for running your Telegram bot and run it separately.

All you need to do is to specify DJANGO_SETTINGS_MODULE environment variable to help Django find your settings module. If so, you can still access django from your other scripts. I understand that you're likely seeking for a way to get data from Django ORM inside the Telegram bot or use some other Django features. Different configurations of the web server in different environments will make it harder to write the correct and scalable code for serving both a web app and a Telegram bot. Moreover, now you are using Django Development server using manage.py command, but if you're going to deploy your application to production environment, your configuration will differ: you should use some production-ready solution like gunicorn.

I added this code to the apps.py file of one the project's app but it's not working. from django.apps import AppConfigĭefault_auto_field = 'django.db.models.BigAutoField'

I'm using python-telegram-bot but do not know how to start the bot when the django server starts.

I'm developing a djnago project and want to connect a telegram bot to it.
