Reputation: 71
I am trying to integrate elastic within the django existing db. but within the site packages i am facing Errors on running the local server or to view the respective commands.
Below is the versions of packages i m using, django-elasticsearch-dsl==0.5.0, elasticsearch==6.3.0 and elasticsearch-dsl==6.2.1.
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "Desktop/envs/elas_envs/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "Desktop/envs/elas_envs/lib/python3.6/site-packages/django/core/management/__init__.py", line 337, in execute
django.setup()
File "/homeDesktop/envs/elas_envs/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/Desktop/envs/elas_envs/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/Desktop/envs/elas_envs/lib/python3.6/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/home//Desktop/envs/elas_envs/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/Desktop/envs/elas_envs/lib/python3.6/site-packages/django_elasticsearch_dsl/__init__.py", line 3, in <module>
from .documents import DocType # noqa
File "/home/Desktop/envs/elas_envs/lib/python3.6/site-packages/django_elasticsearch_dsl/documents.py", line 8, in <module>
from elasticsearch_dsl.document import DocTypeMeta as DSLDocTypeMeta
ImportError: cannot import name 'DocTypeMeta'
Thanks in advance.
Upvotes: 1
Views: 3492
Reputation: 5907
This question is from almost two years ago but this could help others. In latest versions of django_elasticsearch_dsl you need to use Document:
from django_elasticsearch_dsl import (
Document,
fields,
Index,
)
Upvotes: 2
Reputation: 691
Like described in this issue this is the result of lack of backward compatibility of elasticsearch-dsl
package, starting from version 6.2.0
onwards.
Temporary solution is to just use older version of package, prior to breaking changes:
pip install elasticsearch-dsl==6.1.0
Hopefully this will get fixed soon.
Upvotes: 2