首页 > 解决方案 > Elastic Beanstalk 找不到/使用我的 requirements.txt 文件,因此找不到模块“django”

问题描述

我正在尝试使用 django 部署 python web 应用程序并已成功设置 EB 环境,但由于某种原因,它没有使用我的 requirements.txt 文件来安装所需的模块(django 和 pytz)。我没有看到对无效 requirements.txt 的引用,所以我认为这不是问题所在。这是文件层次结构和最新日志。

FirstWebApp/
    .elasticbeanstalk/
        config.yml
    mysite/
        #..
    polls/
        #..
    db.sqlite3
    manage.py
    requirements.txt


[Sat Sep 01 21:08:01.508757 2018] [mpm_prefork:notice] [pid 7866] AH00169: caught SIGTERM, shutting down
[Sat Sep 01 21:08:02.599699 2018] [suexec:notice] [pid 11160] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat Sep 01 21:08:02.615594 2018] [so:warn] [pid 11160] AH01574: module wsgi_module is already loaded, skipping
[Sat Sep 01 21:08:02.617699 2018] [http2:warn] [pid 11160] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Sat Sep 01 21:08:02.617712 2018] [http2:warn] [pid 11160] AH02951: mod_ssl does not seem to be enabled
[Sat Sep 01 21:08:02.618263 2018] [lbmethod_heartbeat:notice] [pid 11160] AH02282: No slotmem from mod_heartmonitor
[Sat Sep 01 21:08:02.618326 2018] [:warn] [pid 11160] mod_wsgi: Compiled for Python/3.6.2.
[Sat Sep 01 21:08:02.618331 2018] [:warn] [pid 11160] mod_wsgi: Runtime using Python/3.6.5.
[Sat Sep 01 21:08:02.620634 2018] [mpm_prefork:notice] [pid 11160] AH00163: Apache/2.4.33 (Amazon) mod_wsgi/3.5 Python/3.6.5 configured -- resuming normal operations
[Sat Sep 01 21:08:02.620651 2018] [core:notice] [pid 11160] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sat Sep 01 21:08:05.381076 2018] [:error] [pid 11165] [remote 127.0.0.1:0] mod_wsgi (pid=11165): Target WSGI script '/opt/python/current/app/mysite/wsgi.py' cannot be loaded as Python module.
[Sat Sep 01 21:08:05.381116 2018] [:error] [pid 11165] [remote 127.0.0.1:0] mod_wsgi (pid=11165): Exception occurred processing WSGI script '/opt/python/current/app/mysite/wsgi.py'.
[Sat Sep 01 21:08:05.381287 2018] [:error] [pid 11165] [remote 127.0.0.1:0] Traceback (most recent call last):
[Sat Sep 01 21:08:05.381309 2018] [:error] [pid 11165] [remote 127.0.0.1:0]   File "/opt/python/current/app/mysite/wsgi.py", line 12, in <module>
[Sat Sep 01 21:08:05.381313 2018] [:error] [pid 11165] [remote 127.0.0.1:0]     from django.core.wsgi import get_wsgi_application
[Sat Sep 01 21:08:05.381326 2018] [:error] [pid 11165] [remote 127.0.0.1:0] ModuleNotFoundError: No module named 'django'
[Sat Sep 01 21:08:06.384353 2018] [:error] [pid 11165] [remote 127.0.0.1:252] mod_wsgi (pid=11165): Target WSGI script '/opt/python/current/app/mysite/wsgi.py' cannot be loaded as Python module.
[Sat Sep 01 21:08:06.384403 2018] [:error] [pid 11165] [remote 127.0.0.1:252] mod_wsgi (pid=11165): Exception occurred processing WSGI script '/opt/python/current/app/mysite/wsgi.py'.
[Sat Sep 01 21:08:06.384505 2018] [:error] [pid 11165] [remote 127.0.0.1:252] Traceback (most recent call last):
[Sat Sep 01 21:08:06.384528 2018] [:error] [pid 11165] [remote 127.0.0.1:252]   File "/opt/python/current/app/mysite/wsgi.py", line 12, in <module>
[Sat Sep 01 21:08:06.384531 2018] [:error] [pid 11165] [remote 127.0.0.1:252]     from django.core.wsgi import get_wsgi_application
[Sat Sep 01 21:08:06.384560 2018] [:error] [pid 11165] [remote 127.0.0.1:252] ModuleNotFoundError: No module named 'django'
[Sat Sep 01 21:08:07.387609 2018] [:error] [pid 11165] [remote 127.0.0.1:2304] mod_wsgi (pid=11165): Target WSGI script '/opt/python/current/app/mysite/wsgi.py' cannot be loaded as Python module.
[Sat Sep 01 21:08:07.387656 2018] [:error] [pid 11165] [remote 127.0.0.1:2304] mod_wsgi (pid=11165): Exception occurred processing WSGI script '/opt/python/current/app/mysite/wsgi.py'.
[Sat Sep 01 21:08:07.387725 2018] [:error] [pid 11165] [remote 127.0.0.1:2304] Traceback (most recent call last):
[Sat Sep 01 21:08:07.387744 2018] [:error] [pid 11165] [remote 127.0.0.1:2304]   File "/opt/python/current/app/mysite/wsgi.py", line 12, in <module>
[Sat Sep 01 21:08:07.387748 2018] [:error] [pid 11165] [remote 127.0.0.1:2304]     from django.core.wsgi import get_wsgi_application
[Sat Sep 01 21:08:07.387761 2018] [:error] [pid 11165] [remote 127.0.0.1:2304] ModuleNotFoundError: No module named 'django'
[Sat Sep 01 21:08:08.390656 2018] [:error] [pid 11165] [remote 127.0.0.1:2304] mod_wsgi (pid=11165): Target WSGI script '/opt/python/current/app/mysite/wsgi.py' cannot be loaded as Python module.
[Sat Sep 01 21:08:08.390700 2018] [:error] [pid 11165] [remote 127.0.0.1:2304] mod_wsgi (pid=11165): Exception occurred processing WSGI script '/opt/python/current/app/mysite/wsgi.py'.
[Sat Sep 01 21:08:08.390770 2018] [:error] [pid 11165] [remote 127.0.0.1:2304] Traceback (most recent call last):
[Sat Sep 01 21:08:08.390790 2018] [:error] [pid 11165] [remote 127.0.0.1:2304]   File "/opt/python/current/app/mysite/wsgi.py", line 12, in <module>
[Sat Sep 01 21:08:08.390793 2018] [:error] [pid 11165] [remote 127.0.0.1:2304]     from django.core.wsgi import get_wsgi_application
[Sat Sep 01 21:08:08.390807 2018] [:error] [pid 11165] [remote 127.0.0.1:2304] ModuleNotFoundError: No module named 'django'

标签: djangoamazon-web-servicesamazon-elastic-beanstalkrequirements.txt

解决方案


我只需要提交requirements.txt文件。Django 只查看已提交的任何文件。


推荐阅读