viewflow / django-material

Material Design for Django
http://viewflow.io/
BSD 3-Clause "New" or "Revised" License
2.48k stars 424 forks source link

Receiving SynchronousOnlyOperation at /admin/ #516

Closed reeshabhranjan closed 2 years ago

reeshabhranjan commented 2 years ago

I followed this to setup the same: http://docs.viewflow.io/viewflow_frontend.html.

Entire traceback:

[01/Jan/2022 ERROR] Internal Server Error: /admin/ -- [log C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\utils\log.py:224 - log_response]
Traceback (most recent call last):
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\asgiref\sync.py", line 482, in thread_handler
    raise exc_info[1]
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\core\handlers\exception.py", line 38, in inner
    response = await get_response(request)
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\core\handlers\base.py", line 219, in _get_response_async
    callback, callback_args, callback_kwargs = self.resolve_request(request)
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\core\handlers\base.py", line 290, in resolve_request
    resolver_match = resolver.resolve(request.path_info)
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\urls\resolvers.py", line 558, in resolve
    sub_match = pattern.resolve(new_path)
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\urls\resolvers.py", line 558, in resolve
    sub_match = pattern.resolve(new_path)
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\urls\resolvers.py", line 558, in resolve
    sub_match = pattern.resolve(new_path)
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\material\frontend\urlconf.py", line 43, in resolve
    if result and not getattr(self._module, 'installed', True):
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\material\frontend\apps.py", line 69, in installed
    return DbModule.objects.installed(self.label)
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\material\frontend\models.py", line 21, in installed
    installed_cache = [mod.label for mod in self.get_queryset().filter(installed=True)]
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\db\models\query.py", line 280, in __iter__
    self._fetch_all()
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\db\models\query.py", line 1324, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\db\models\query.py", line 51, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1173, in execute_sql
    cursor = self.connection.cursor()
  File "C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\django\utils\asyncio.py", line 24, in inner
    raise SynchronousOnlyOperation(message)
django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
[01/Jan/2022 ERROR] HTTP GET /admin/ 500 [0.04, 127.0.0.1:29255] -- [runserver C:\Users\user\Desktop\testproject\backend\venv\lib\site-packages\channels\management\commands\runserver.py:160 - log_action]
kmmbvnr commented 2 years ago

Could you specify the django-material package version?

kmmbvnr commented 2 years ago

This should be already fixed in the latest django-material release.

Please reopen the issue, if it's not