Reputation:
When I run an "pip install" it works and the package installs. Here is an example for the import-export package:
Installing collected packages: xlrd, pyyaml, xlwt, unicodecsv, jdcal, et-xmlfile, openpyxl, defusedxml, odfpy, tablib, diff-match-patch, django-import-export
Successfully installed defusedxml-0.5.0 diff-match-patch-20181111 django-import-export-1.2.0 et-xmlfile-1.0.1 jdcal-1.4 odfpy-1.4.0 openpyxl-2.6.0 pyyaml-3.13 tablib-0.12.1 unicodecsv-0.14.1 xlrd-1.2.0 xlwt-1.3.0
but when I try to run the app with the package, I get this error:
File "~/projects/hosproject/venv/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'import-export'
I have added 'import-export' to my apps. This error occurs when I run "python3 manage.py collectstatic".
Upvotes: 0
Views: 611
Reputation: 185
If "I have added 'import-export' to my apps." means
# settings.py
INSTALLED_APPS = (
...
'import_export',
)
it may be
import import_export
no hyphen, it is underbar
Upvotes: 1
Reputation: 282
I think you are using "Django-import-export"
.
In your settings.py you must add the following.
# settings.py
INSTALLED_APPS = (
...
'import_export',
)
and then use $ manage.py collectstatic
For more information read this documentation
Upvotes: 0