Search code examples
pythonpython-3.xdjangodjango-modelsbotframework

what is happening on os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"


I am creating a bot using botframework within a django application.
At first, I was not able to call the models of that application from the bot. I found a solution, which was to put os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = True in the settings.py file.

It works fine for me.

But I am curious to know, what is happening when I do this. Is it safe?


Solution

  • Setting DJANGO_ALLOW_ASYNC_UNSAFE to true is not a recommended way. It may cause data loss. So, I changed the function as an API end-point and called it, instead of calling the function. It works for me.