我开始使用 AWS 的 Elastic Beanstalk。
我正在关注这个 tutorial 部署 Django/PostgreSQL 应用程序。
我在“配置数据库”部分之前完成了所有工作。部署也成功,但出现内部服务器错误。
这是日志的回溯:
mod_wsgi (pid=30226): Target WSGI script '/opt/python/current/app/polly/wsgi.py' cannot be loaded as Python module.
[Tue Sep 15 12:06:43.472954 2015] [:error] [pid 30226] [remote 172.31.14.126:53947] mod_wsgi (pid=30226): Exception occurred processing WSGI script '/opt/python/current/app/polly/wsgi.py'.
[Tue Sep 15 12:06:43.474702 2015] [:error] [pid 30226] [remote 172.31.14.126:53947] Traceback (most recent call last):
[Tue Sep 15 12:06:43.474727 2015] [:error] [pid 30226] [remote 172.31.14.126:53947] File "/opt/python/current/app/polly/wsgi.py", line 12, in <module>
[Tue Sep 15 12:06:43.474777 2015] [:error] [pid 30226] [remote 172.31.14.126:53947] from django.core.wsgi import get_wsgi_application
[Tue Sep 15 12:06:43.474799 2015] [:error] [pid 30226] [remote 172.31.14.126:53947] ImportError: No module named django.core.wsgi
知道哪里出了问题吗?
最佳答案
您是否在应用程序的根目录中创建了 requirements.txt
? Elastic Beanstalk will automatically install the packages from this file upon deployment. (请注意,它可能需要 checkin 源代码管理才能部署。)
pip freeze > requirements.txt
(您可能希望从 virtualenv 中执行此操作,以便您只选择应用程序实际需要运行的包。使用系统执行此操作 Python 将选择您在系统范围内安装的每个包。 )
关于python - Elastic Beanstalk 中的导入错误 : No module named django. core.wsgi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32586612/