I've used the following tutorial . I used the command pip install django-import-export
, then added to the Installed Apps section.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'import_export',
'frontend',
'userauth',
'methods',
]
When I run python manage.py collectstatic
I get error ModuleNotFoundError: No module named 'import_export'
Install the import_export module by writing this command in command prompt
pip install --user django-import_export
or use pip install django-import_export
I guess you used virtual environment to develop some parts of your project (maybe accidentally) and then you switched it off.
Try to reinstall the modules with your virtual environment activated.
I had the same bug before, and here is what I did.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.conf',
'import_export',]
Be careful, the order of 'django.conf'
and 'import_export'
cannot be changed.
I guess you have installed Django in virtualenv
. Now when you installed django-import-export
you forgot to activate your virtual environment. I doubt there is something else.
Also make sure that your virtual environment is enabled when you run django manage.py collectstatic
. You might have installed Django outside all virtual environments once in the past (by mistake) and is therefore not raising "Django not found" errors but cannot find import_export
because you actually installed it in virtual environment.
Simple please install django-import-export==2.5.0
i hope its work
Delete your virtual env directory.
rm -rf env
Come out of the virtual env.
exec $SHELL
Create the virtual environment again.
python -m venv env
Activate your virtual env.
source ./env/bin/activate
Install the requirements again.
pip install -r requirements.txt
And it worked
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.