I use Django 3.0.6 and Jupyter notebook running with shell_plus --notebook.
I try run queryset:
User.objects.all()
But return this error SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
I try this command
from asgiref.sync import sync_to_async
users = sync_to_async(User.objects.all())
for user in users:
print(user)
TypeError: 'SyncToAsync' object is not iterable
The solution of Django documentation
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true" in settings.py is the unique solution?