Advertisement
Guest User

Untitled

a guest
Oct 26th, 2022
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.20 KB | Source Code | 0 0
  1. SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
  2.   File "contextlib.py", line 74, in inner
  3.     return func(*args, **kwds)
  4.   File "django/views/decorators/csrf.py", line 54, in wrapped_view
  5.     return view_func(*args, **kwargs)
  6.   File "rest_framework/viewsets.py", line 125, in view
  7.     return self.dispatch(request, *args, **kwargs)
  8.   File "rest_framework/views.py", line 509, in dispatch
  9.     response = self.handle_exception(exc)
  10.   File "rest_framework/views.py", line 469, in handle_exception
  11.     self.raise_uncaught_exception(exc)
  12.   File "rest_framework/views.py", line 480, in raise_uncaught_exception
  13.     raise exc
  14.   File "rest_framework/views.py", line 506, in dispatch
  15.     response = handler(request, *args, **kwargs)
  16.   File "social_inbox/api/v1/views/social_content/app.py", line 46, in create
  17.     serializer.is_valid(raise_exception=True)
  18.   File "rest_framework/serializers.py", line 220, in is_valid
  19.     self._validated_data = self.run_validation(self.initial_data)
  20.   File "rest_framework/serializers.py", line 419, in run_validation
  21.     value = self.to_internal_value(data)
  22.   File "rest_framework/serializers.py", line 476, in to_internal_value
  23.     validated_value = field.run_validation(primitive_value)
  24.   File "rest_framework/relations.py", line 153, in run_validation
  25.     return super().run_validation(data)
  26.   File "rest_framework/fields.py", line 568, in run_validation
  27.     value = self.to_internal_value(data)
  28.   File "rest_framework/relations.py", line 462, in to_internal_value
  29.     return queryset.get(**{self.slug_field: data})
  30.   File "django/db/models/query.py", line 431, in get
  31.     num = len(clone)
  32.   File "django/db/models/query.py", line 262, in __len__
  33.     self._fetch_all()
  34.   File "django/db/models/query.py", line 1324, in _fetch_all
  35.     self._result_cache = list(self._iterable_class(self))
  36.   File "django/db/models/query.py", line 51, in __iter__
  37.     results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  38.   File "django/db/models/sql/compiler.py", line 1173, in execute_sql
  39.     cursor = self.connection.cursor()
  40.   File "django/utils/asyncio.py", line 24, in inner
  41.     raise SynchronousOnlyOperation(message)
  42.  
  43. SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
  44.   File "django/db/transaction.py", line 278, in __exit__
  45.     connection.rollback()
  46.   File "django/utils/asyncio.py", line 24, in inner
  47.     raise SynchronousOnlyOperation(message)
  48.  
  49. SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
  50.   File "django/core/handlers/exception.py", line 47, in inner
  51.     response = get_response(request)
  52.   File "django/core/handlers/base.py", line 181, in _get_response
  53.     response = wrapped_callback(request, *callback_args, **callback_kwargs)
  54.   File "contextlib.py", line 74, in inner
  55.     return func(*args, **kwds)
  56.   File "django/db/transaction.py", line 290, in __exit__
  57.     connection.set_autocommit(True)
  58.   File "django/db/backends/base/base.py", line 405, in set_autocommit
  59.     self.ensure_connection()
  60.   File "django/utils/asyncio.py", line 24, in inner
  61.     raise SynchronousOnlyOperation(message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement