Closed NuxitBrain closed 8 months ago
Hi, please provide full traceback so we can see where it's coming from.
I don't see no_dereferencing_class
in our code, so that's probably something else.
Here is the full traceback
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/metadatacell/projects/
Django Version: 4.2.0
Python Version: 3.11.7
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django_mongoengine',
'django_mongoengine.mongo_auth',
'django_mongoengine.mongo_admin',
'bootstrap3',
'metadatacell')
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "C:\Users\aneveu\AppData\Local\anaconda3\envs\django2\Lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Users\aneveu\AppData\Local\anaconda3\envs\django2\Lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\aneveu\OneDrive - BolloreSA\Documents\Data_travail\Programme\DAnalyse\frontend\metadatacell\views.py", line 35, in projects
print(projects)
File "C:\Users\aneveu\AppData\Local\anaconda3\envs\django2\Lib\site-packages\mongoengine\queryset\queryset.py", line 73, in __repr__
self._populate_cache()
File "C:\Users\aneveu\AppData\Local\anaconda3\envs\django2\Lib\site-packages\mongoengine\queryset\queryset.py", line 128, in _populate_cache
self._result_cache.append(next(self))
File "C:\Users\aneveu\AppData\Local\anaconda3\envs\django2\Lib\site-packages\mongoengine\queryset\base.py", line 1636, in __next__
_auto_dereference=self._auto_dereference,
File "C:\Users\aneveu\AppData\Local\anaconda3\envs\django2\Lib\site-packages\mongoengine\queryset\base.py", line 1768, in _auto_dereference
should_deref = not no_dereferencing_active_for_class(self._document)
File "C:\Users\aneveu\AppData\Local\anaconda3\envs\django2\Lib\site-packages\mongoengine\context_managers.py", line 28, in no_dereferencing_active_for_class
return cls in thread_locals.no_dereferencing_class
Exception Type: AttributeError at /metadatacell/projects/
Exception Value: '_thread._local' object has no attribute 'no_dereferencing_class'
and in fact i do not use no_dereferencing_class
. This is a very simple test of geting a variable from a document
https://github.com/MongoEngine/mongoengine/issues/2799
yeah, that's related to mongoengine
Try downgrading it to 0.27.0.
MongoEngine 0.28.1 will be published in a few minutes with a bugfix
I confirm that it fix this bug ! thank you very much for the help. Maybe by the setup.py should by updated to avoid this problem again ?
That's unnecessary.
hello everyone
maybe this error on my part put in didn't success to fix it : here is my model :
when i querry on djnago shell everything is fine :
But with this view :
I get this error :
AttributeError: '_thread._local' object has no attribute 'no_dereferencing_class'
Did i miss something with mongoengine or this is a bug of django_mongoengine ?
python version : 3.11.7 django : 4.2 django mongoengine : 0.6.0b2