首页 > 解决方案 > 使用 Django 的 Elelastic Beanstalk 上的 WSGI 问题

问题描述

几天前,我在 AWS elastic beanstalk(EB) 上部署了一个 Django,它运行良好。今天,在新部署之后,我对 view.py 做了一些小改动,EB 上的 Django APP 出现了一个非常大的问题,它变得无法访问了。查看 AWS EB 中的日志文件,我读到了以下错误:

 Script timed out before returning headers: wsgi.py
 End of script output before headers: wsgi.py, referer ...  

您对如何解决此问题有任何想法吗?

我要提前谢谢你,

标签: djangoamazon-web-servicesamazon-elastic-beanstalk

解决方案


两种可能的解决方案(取决于您的具体情况)

这是解决此特定问题 End of script output before headers 的类似问题:wsgi.py deploying python django to AWS EB

将此 WSGIApplicationGroup %{GLOBAL} 添加到您的 wsgi 配置中。它指导您的 wsgi 应用程序 - 您的 django 应用程序“在 Python 初始化时创建的第一个 Python 子解释器中运行”(来自https://modwsgi.readthedocs.io/en/develop/user-guides/application-issues。 html#python-simplified-gil-state-api )

另一种解决方案与增加您正在使用的实例的内存有关。


推荐阅读