ModuleNotFoundError:没有名为“django”的模块

dca*_*ave 4 python django amazon-web-services python-3.x amazon-elastic-beanstalk

我已经使用 django 在虚拟环境中构建了一个站点,并按照 AWS 文档中的步骤部署该站点。我已使用 Elastic Beanstalk 将我的网站部署到 AWS Web 服务器,并设置了运行 3.6 和 django 2.1.1 的 python 环境。我已提取日志并收到以下错误:

Traceback (most recent call last):
File "/opt/python/current/app/weddingProject/wsgi.py", line 12, in <module>
from django.core.wsgi import get_wsgi_application
ModuleNotFoundError: No module named 'django'
Target WSGI script '/opt/python/current/app/weddingProject/wsgi.py' cannot be loaded as Python module.
Run Code Online (Sandbox Code Playgroud)

我读过其他帖子,他们说 django 没有安装,但是,requirements.txt 文件确实将其列为要安装的包。所以我不确定是什么导致了问题,也不知道如何检查服务器以确保它已安装。

当我运行 pip freeze >requirements.txt 时,我确实看到 django 被列为要安装的包。我运行 eb deploy ,但由于某种原因 django 没有安装。

Bej*_*jür 6

我有同样的问题。文件requirements.txt比应有的深度更深一层。将其放在requirements.txt同一目录中.elasticbeanstalk/

\n

例子:

\n
\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 .ebextensions\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 01_packages.config\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 02_python.config\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 .elasticbeanstalk\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 config.yml\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 testproject\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 db.sqlite3\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 cust_app\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 admin.py\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 apps.py\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 models.py\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 tests.py\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 urls.py\n\xe2\x94\x82   \xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 views.py\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 manage.py\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 testproject\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 asgi.py\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 settings.py\n\xe2\x94\x82       \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 urls.py\n\xe2\x94\x82       \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 wsgi.py\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 requirements.txt\n
Run Code Online (Sandbox Code Playgroud)\n