尽管已安装,但没有名为import_export的模块

时间:2019-05-26 06:42:25

标签: python django amazon-web-services django-admin django-import-export

我正在尝试在django网站中使用django-import-export。我使用“ pip install django-import-export”将其安装在我的虚拟环境中,我知道它在那里,因为我运行了pip冻结,但是当我执行“ eb create django-env”时仍然出现错误:“ ModuleNotFoundError:未命名模块'进出口'”。

它包含在settings.py的INSTALLED_APPS中,在出现错误之前我运行了“ python manage.py collectstatic”。

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.

我是一个初学者,这是我关于StackOverflow的第一个问题。感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

我想我知道以前做错了什么。我在我的环境中检查了requirements.txt文件,但没有提到django-import-export。

“ Elastic Beanstalk使用requirements.txt来确定要在运行您的应用程序的EC2实例上安装哪个软件包。”

所以我进行了点冻结> requirements.txt,然后检查以确保requirements.txt文件已更新。之后,部署工作正常了,现在我可以在admin中看到导入按钮!

相关问题