简体   繁体   English

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

[英]Successful Django Deploy Through AWS Elastic Beanstalk, But Getting 500 ERROR

I've been stuck on this for the last week and I'm fairly lost as to what do for next steps.上周我一直被困在这个问题上,对于下一步该怎么做,我相当迷茫。

I have a Django application that uses a MySQL database.我有一个使用 MySQL 数据库的 Django 应用程序。 I've deployed it using AWS Elastic Beanstalk using the following tutorial : https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html我已经使用以下教程使用 AWS Elastic Beanstalk 部署了它: https : //docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html

It successfully deployed.它成功部署。 However, I keep getting 500 errors when trying to access the site.但是,在尝试访问该站点时,我不断收到 500 错误。 I've also updated the host value as well.我还更新了主机值。

Here's the error_log, but I'm not able to deduce much from it.这是 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'

If anyone could provide some insight/help/further steps, it would be greatly appreciated.如果有人可以提供一些见解/帮助/进一步的步骤,将不胜感激。 I can provide more logs, etc anything else that would help.我可以提供更多日志等任何其他有帮助的东西。 Thank you.谢谢你。

You could try installing the ssl module on your ec2 : sudo yum install mod_ssl for your httpd issue.您可以尝试在您的 ec2 上安装 ssl 模块: sudo yum install mod_ssl 以解决您的 httpd 问题。

Also, if you are using a load balancer, you might want to check the health status of your targets.此外,如果您使用的是负载均衡器,您可能需要检查目标的运行状况。 When the health checks fail, you get 500 errors.当运行状况检查失败时,您会收到 500 个错误。

From your log, I think this is the culprit:从你的日志来看,我认为这是罪魁祸首:

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__

I checked the file /usr/lib64/python3.6/asyncio/base_events.py and found something similar to this:我检查了文件/usr/lib64/python3.6/asyncio/base_events.py并发现了类似的东西:

    def __del__(self):
        if not self.is_closed():
            warnings.warn(f"unclosed event loop {self!r}", ResourceWarning,
                          source=self)
            if not self.is_running():
                self.close()

Seems like you're deleting the event loop without calling close before.似乎您在删除事件循环之前没有调用close

( ResourceWarning is a built-in class, I'm not sure why it's undefined though) ResourceWarning是一个内置类,我不知道为什么它是未定义的)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 django 部署到 AWS Elastic Beanstalk - deploy django to AWS Elastic Beanstalk Django 的 AWS Elastic Beanstalk 500 内部服务器错误 - AWS Elastic Beanstalk 500 Internal Server Error with Django Django 内部服务器 500 错误 AWS Elastic-Beanstalk 问题 - Django Internal Server 500 Error AWS Elastic-Beanstalk issue AWS Elastic Beanstalk 500错误(Django)-Python-urllib / 2.7和静态文件错误 - AWS Elastic Beanstalk 500 error (Django) - Python-urllib/2.7 & static files error 在AWS Elastic Beanstalk上进行Django App Deploy错误:关系“ django_site”不存在 - Django App Deploy on AWS Elastic Beanstalk Error: relation “django_site” does not exist 在 AWS Elastic Beanstalk 上部署 Django-Wagtail 应用程序时出现 500 内部服务器错误 - 500 internal server error deploying Django-Wagtail application on AWS Elastic Beanstalk AWS Django Elastic Beanstalk 迁移错误 - AWS Django Elastic Beanstalk migration error 使用 AWS Elastic Beanstalk 托管 Django 应用程序时出错 - Error in hosting Django app with AWS Elastic Beanstalk Django,AWS Elastic Beanstalk - Django, AWS Elastic Beanstalk Heroku/Django 部署:为什么我在成功部署和 static 收集时收到错误 500? - Heroku/Django deploy: why am I getting an error 500 with successful deploy and static collection?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM