简体   繁体   中英

No module named import_export although it is installed

I'm trying to use django-import-export in my django site. I installed it in my virtual environment using "pip install django-import-export" and I know it's there because I ran pip freeze but it still gives an error when I do "eb create django-env": "ModuleNotFoundError: No module named 'import_export'".

It is included in INSTALLED_APPS in settings.py and I ran "python manage.py collectstatic" before I got the error.

2019-05-26 06:21:41    ERROR   [Instance: i-08f7c48c9afd84a8f] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ile "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'import_export'.
container_command 01_migrate in .ebextensions/db-migrate.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-05-26 06:21:41    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-05-26 06:22:44    ERROR   Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

ERROR: ServiceError - Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

I am a beginner and this is my first question on StackOverflow. I appreciate any help.

也许您没有成功安装django-import-export。尝试检查您的虚拟环境。

I think I understand what I did wrong before. I checked the requirements.txt file in my environment and it didn't mention django-import-export.

"Elastic Beanstalk uses requirements.txt to determine which package to install on the EC2 instances that run your application."

So I did pip freeze > requirements.txt, then checked to make sure that the requirements.txt file was updated. After that the deployment worked and I can now see the import button in the admin!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM