Can you connect to a Django backend via a python separate file? if both are running locally

For example, when I would create a ruby and react app. I could run the ruby app on local.host:3000 and the react app on local.host:4000. With some configuration, I could fetch information from my ruby backend and send information from by react frontend.

Currently, I am working on building a bot on discord, with a django frontend/backend. I need to run the python bot at the same time as the Django website. I run the bot via "python main.py". I run the django project via "python3 manage.py runserver" runs on http://127.0.0.1:8000/. They both work fine at the same time, but I want the bot to be able to send information to the django project.

I don't believe its like ruby. I cant just fetch to http://127.0.0.1:8000/ bc that is not the backend. That is the frontend of the site(?).

So, is there anyway for me to get the URL of the django backend, so I can send information to it via my python bot. I cannot seem to find an article on this, any help would be greatly appreciated. Thanks!

Back to Top