Closed macmichael01 closed 1 year ago
From what i can see from the error above. Since you're using WSGI which gunicorn is, then you have to use the django provided method after you have defined the function:
**_
from asgiref.sync import sync_to_async get_user_info = sync_to_async(_get_user_info, thread_sensitive=True)
_**
Else, all you need to do is to upgrade your website sandbox from WSGI to ASGI and make the relevant changes on your django project folder. If you find this helpful reachout on Upwork, my Profile name is Ayanlade Olawale, I saw your post on upwork
V6 fully async
Describe the error
I have a Django project that I am working on where I am trying to fetch TikTok user info using a class base view.
I am using gunicorn and Django is throwing an error: SynchronousOnlyOperation error. I added this bit of code to my gunicorn wsgi file
os.environ.setdefault("DJANGO_ALLOW_ASYNC_UNSAFE", "true")
which fixes the problem but seems like a bad idea.The buggy code
Error Trace (if any)
Put the error trace below if there's any error thrown.
Desktop (please complete the following information):