53👍
It works for me
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"
BTW, I start my notebook using the command
./manage.py shell_plus --notebook
10👍
Contrary to other answers I’d suggest just running from the shell as:
env DJANGO_ALLOW_ASYNC_UNSAFE=true ./manage.py shell_plus --notebook
and not modifying any config files or startup scripts.
The advantage of doing it like this is that these checks still seem useful to have enabled almost everywhere else (e.g. when debugging locally via runserver
or when running tests). Disabling via files would easily disable these in too many places negating their advantage.
Note that most shells provide easy ways of recalling previously invoked command lines, e.g. in Bash or Zsh Ctrl+R followed by notebook
would find the last time you ran something that had "notebook" in. Under the fish shell just type notebook
and press the up arrow key to start a reverse search.
- [Django]-Direct assignment to the forward side of a many-to-many set is prohibited. Use emails_for_help.set() instead
- [Django]-Django staticfiles not found on Heroku (with whitenoise)
- [Django]-Default filter in Django model
5👍
For now I plan on just using a forked version of django with a new setting to skip the async_unsafe check. Once the ORM gets async support I’ll probably have to rewrite my project to support it and drop the flag.
EDIT: there’s now a PR to add an env variable (DJANGO_ALLOW_ASYNC_UNSAFE
) to disable the check (https://github.com/django/django/pull/12172)
- [Django]-Django Reverse Accessor Clashes
- [Django]-How to get POST request values in Django?
- [Django]-Get a list of all installed applications in Django and their attributes
1👍
I added
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"
code in the setting.py of your project all the way down to the file and then
command python3 manage.py shell_plus --notebook
if you are using python3 or use python
That’s it. worked for me.
- [Django]-How do I filter ForeignKey choices in a Django ModelForm?
- [Django]-Serialize queryset in Django rest framework
- [Django]-Virtualenv and source version control