Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we be using asgiref.local.Local if available for import? #35

Open
shijl0925 opened this issue Feb 22, 2024 · 0 comments
Open

Should we be using asgiref.local.Local if available for import? #35

shijl0925 opened this issue Feb 22, 2024 · 0 comments

Comments

@shijl0925
Copy link

shijl0925 commented Feb 22, 2024

With django now supporting async, should we be trying to import asgiref.local.Local if available, which is a drop-in async replacement for threading.local?

Perhaps replacing:

from threading import local

With:

try:
from asgiref.local import Local as local
except ImportError:
from threading import local

Would be happy to make a PR for this, but not sure how to approach the situation where asgiref package is available vs when it is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant