Skip to content

when use "uvicorn" to start django project, will get this error "django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async." #30

Open

Description

@zhangweiqaz

File "/data/.../kubeconfig_management/venv/lib/python3.10/site-packages/casbin_adapter/apps.py", line 12, in ready
initialize_enforcer(db_alias)
File "/data/.../kubeconfig_management/venv/lib/python3.10/site-packages/casbin_adapter/enforcer.py", line 67, in initialize_enforcer
with connect.cursor() as cursor:
File "/data/.../kubeconfig_management/venv/lib/python3.10/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.

Activity

  1. casbin-bot commented on May 24, 2024

    @casbin-bot

    @techoner @Nekotoxin

  2. added
    bug
    on May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions