django - 通过 AWS Elastic Beanstalk 成功部署 Django,但出现 500 错误

标签 django amazon-web-services amazon-ec2 amazon-elastic-beanstalk

上周我一直坚持这一点,对于接下来的步骤我很迷茫。

我有一个使用 MySQL 数据库的 Django 应用程序。我使用 AWS Elastic Beanstalk 使用以下教程部署了它:https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html

它成功部署。但是,在尝试访问该站点时,我不断收到 500 个错误。我也更新了主机值。

这是error_log,但我无法从中推断出太多。

[Tue Jan 28 08:05:34.444677 2020] [suexec:notice] [pid 3125] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 28 08:05:34.460731 2020] [http2:warn] [pid 3125] 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.
[Tue Jan 28 08:05:34.460743 2020] [http2:warn] [pid 3125] AH02951: mod_ssl does not seem to be enabled
[Tue Jan 28 08:05:34.461206 2020] [lbmethod_heartbeat:notice] [pid 3125] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 28 08:05:34.461249 2020] [:warn] [pid 3125] mod_wsgi: Compiled for Python/3.6.2.
[Tue Jan 28 08:05:34.461253 2020] [:warn] [pid 3125] mod_wsgi: Runtime using Python/3.6.8.
[Tue Jan 28 08:05:34.463081 2020] [mpm_prefork:notice] [pid 3125] AH00163: Apache/2.4.41 (Amazon) mod_wsgi/3.5 Python/3.6.8 configured -- resuming normal operations
[Tue Jan 28 08:05:34.463096 2020] [core:notice] [pid 3125] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Jan 28 08:06:21.350696 2020] [mpm_prefork:notice] [pid 3125] AH00169: caught SIGTERM, shutting down
[Tue Jan 28 08:06:22.419261 2020] [suexec:notice] [pid 4501] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 28 08:06:22.435310 2020] [so:warn] [pid 4501] AH01574: module wsgi_module is already loaded, skipping
[Tue Jan 28 08:06:22.437572 2020] [http2:warn] [pid 4501] 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.
[Tue Jan 28 08:06:22.437582 2020] [http2:warn] [pid 4501] AH02951: mod_ssl does not seem to be enabled
[Tue Jan 28 08:06:22.438217 2020] [lbmethod_heartbeat:notice] [pid 4501] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 28 08:06:22.438283 2020] [:warn] [pid 4501] mod_wsgi: Compiled for Python/3.6.2.
[Tue Jan 28 08:06:22.438292 2020] [:warn] [pid 4501] mod_wsgi: Runtime using Python/3.6.8.
[Tue Jan 28 08:06:22.440572 2020] [mpm_prefork:notice] [pid 4501] AH00163: Apache/2.4.41 (Amazon) mod_wsgi/3.5 Python/3.6.8 configured -- resuming normal operations
[Tue Jan 28 08:06:22.440593 2020] [core:notice] [pid 4501] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Jan 28 08:08:03.028260 2020] [mpm_prefork:notice] [pid 4501] AH00169: caught SIGTERM, shutting down
Exception ignored in: <bound method BaseEventLoop.__del__ of <_UnixSelectorEventLoop running=False closed=False debug=False>>
Traceback (most recent call last):
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 526, in __del__
NameError: name 'ResourceWarning' is not defined
[Tue Jan 28 08:08:04.152017 2020] [suexec:notice] [pid 4833] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 28 08:08:04.168082 2020] [so:warn] [pid 4833] AH01574: module wsgi_module is already loaded, skipping
[Tue Jan 28 08:08:04.170245 2020] [http2:warn] [pid 4833] 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.
[Tue Jan 28 08:08:04.170256 2020] [http2:warn] [pid 4833] AH02951: mod_ssl does not seem to be enabled
[Tue Jan 28 08:08:04.170793 2020] [lbmethod_heartbeat:notice] [pid 4833] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 28 08:08:04.170852 2020] [:warn] [pid 4833] mod_wsgi: Compiled for Python/3.6.2.
[Tue Jan 28 08:08:04.170856 2020] [:warn] [pid 4833] mod_wsgi: Runtime using Python/3.6.8.
[Tue Jan 28 08:08:04.173067 2020] [mpm_prefork:notice] [pid 4833] AH00163: Apache/2.4.41 (Amazon) mod_wsgi/3.5 Python/3.6.8 configured -- resuming normal operations
[Tue Jan 28 08:08:04.173089 2020] [core:notice] [pid 4833] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Jan 28 08:25:28.783035 2020] [mpm_prefork:notice] [pid 4833] AH00169: caught SIGTERM, shutting down
[Tue Jan 28 08:25:32.859422 2020] [suexec:notice] [pid 5573] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 28 08:25:32.875584 2020] [so:warn] [pid 5573] AH01574: module wsgi_module is already loaded, skipping
[Tue Jan 28 08:25:32.877541 2020] [http2:warn] [pid 5573] 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.
[Tue Jan 28 08:25:32.877552 2020] [http2:warn] [pid 5573] AH02951: mod_ssl does not seem to be enabled
[Tue Jan 28 08:25:32.878103 2020] [lbmethod_heartbeat:notice] [pid 5573] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 28 08:25:32.878167 2020] [:warn] [pid 5573] mod_wsgi: Compiled for Python/3.6.2.
[Tue Jan 28 08:25:32.878174 2020] [:warn] [pid 5573] mod_wsgi: Runtime using Python/3.6.8.
[Tue Jan 28 08:25:32.880448 2020] [mpm_prefork:notice] [pid 5573] AH00163: Apache/2.4.41 (Amazon) mod_wsgi/3.5 Python/3.6.8 configured -- resuming normal operations
[Tue Jan 28 08:25:32.880477 2020] [core:notice] [pid 5573] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Wed Jan 29 01:11:07.166917 2020] [mpm_prefork:notice] [pid 5573] AH00169: caught SIGTERM, shutting down
Exception ignored in: <bound method BaseEventLoop.__del__ of <_UnixSelectorEventLoop running=False closed=False debug=False>>
Traceback (most recent call last):
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 526, in __del__
NameError: name 'ResourceWarning' is not defined
[Wed Jan 29 01:11:08.333254 2020] [suexec:notice] [pid 28706] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Jan 29 01:11:08.349662 2020] [so:warn] [pid 28706] AH01574: module wsgi_module is already loaded, skipping
[Wed Jan 29 01:11:08.351804 2020] [http2:warn] [pid 28706] 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.
[Wed Jan 29 01:11:08.351813 2020] [http2:warn] [pid 28706] AH02951: mod_ssl does not seem to be enabled
[Wed Jan 29 01:11:08.352386 2020] [lbmethod_heartbeat:notice] [pid 28706] AH02282: No slotmem from mod_heartmonitor
[Wed Jan 29 01:11:08.352447 2020] [:warn] [pid 28706] mod_wsgi: Compiled for Python/3.6.2.
[Wed Jan 29 01:11:08.352451 2020] [:warn] [pid 28706] mod_wsgi: Runtime using Python/3.6.8.
[Wed Jan 29 01:11:08.354766 2020] [mpm_prefork:notice] [pid 28706] AH00163: Apache/2.4.41 (Amazon) mod_wsgi/3.5 Python/3.6.8 configured -- resuming normal operations
[Wed Jan 29 01:11:08.354783 2020] [core:notice] [pid 28706] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

如果有人可以提供一些见解/帮助/进一步的步骤,将不胜感激。我可以提供更多日志等任何其他有用的信息。谢谢你。

最佳答案

您可以尝试在您的 ec2 上安装 ssl 模块: sudo yum install mod_ssl 解决您的 httpd 问题。

此外,如果您使用的是负载均衡器,您可能需要检查目标的运行状况。当运行状况检查失败时,您会收到 500 个错误。

关于django - 通过 AWS Elastic Beanstalk 成功部署 Django,但出现 500 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59959629/

相关文章:

django url 标签性能

ios - 对 HTTPS 域的 alamofire 请求与对 HTTP 域的请求有什么不同吗?

node.js - 无法使用 ssl 和 apache 连接到 websocket

amazon-web-services - IAM 用户可以为我的 AWS 账户上的服务付费吗?

hadoop - 在AWS EC2上进行Hadoop初始设置?

amazon-ec2 - AWS 启动配置未获取用户数据

Python 相当于 wordpress sanitize_text

python - 在 Django 管理端对具有相同数据的模型的 my-sql 列对象进行分组

javascript - 无法在 okta POST/ session API 调用中使用 SessionToken 创建 session

ubuntu - 如何修复 apt-get : command not found on AWS EC2?