弹性豆茎wsgi.py:脚本之前返回头超时 [英] Script timed out before returning headers: wsgi.py on elastic beanstalk

查看:1422
本文介绍了弹性豆茎wsgi.py:脚本之前返回头超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想部署一个Django应用程序弹性魔豆。当我访问的页面它永远不会加载。日志说:

I'm trying to deploy a Django application to Elastic Beanstalk. When I visit the page it never loads. The logs say:

Script timed out before returning headers: wsgi.py

我可以ssh到服务器并运行 manage.py的runserver 然后卷曲127.0.0.1:8000 从另一个终端,这将成功地返回的网页。所以我假设它必须与设置为弹性魔豆的一部分Apache配置的问题。

I can ssh into the server and run manage.py runserver and then curl 127.0.0.1:8000 from another terminal, which will return the page successfully. So I'm assuming it must be an issue with the Apache configuration that is set up as a part of Elastic Beanstalk.

下面是更多的日志:

[pid 15880] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[so:warn] [pid 15880] AH01574: module wsgi_module is already loaded, skipping
[auth_digest:notice] [pid 15880] AH01757: generating secret for digest authentication ...
[lbmethod_heartbeat:notice] [pid 15880] AH02282: No slotmem from mod_heartmonitor
[mpm_prefork:notice] [pid 15880] AH00163: Apache/2.4.9 (Amazon) mod_wsgi/3.4 Python/2.7.5       configured -- resuming normal operations
[core:notice] [pid 15880] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[:error] [pid 15881] /opt/python/run/venv/lib/python2.7/site-packages/numpy/oldnumeric/__init__.py:11: ModuleDeprecationWarning: The oldnumeric module will be dropped in Numpy 1.9
[:error] [pid 15881]   warnings.warn(_msg, ModuleDeprecationWarning)
[:error] [pid 15881] 
[core:error] [pid 15884] [client 10.248.110.45:58996] Script timed out before returning headers: wsgi.py

和我wsgi.py文件:

And my wsgi.py file:

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aurora.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

任何线索,这可能是导致此?

Any clues as to what could be causing this?

更新:

我重建环境,再次遇到了这个问题。我更新 /etc/httpd/conf.d/wsgi.conf 包括 WSGIApplicationGroup%{GLOBAL} 这里提及。我使用SciPy的,numpy的和GeoDjango内置(使用GDAL)。我知道GDAL并不完全是线程安全的,我不知道别人,但我猜想这是一个线程安全的问题。

I rebuilt my environment and ran into this issue again. I updated /etc/httpd/conf.d/wsgi.conf to include WSGIApplicationGroup %{GLOBAL} as mentioned here. I am using Scipy, Numpy, and GeoDjango (which uses GDAL). I know GDAL is not entirely thread safe and I'm not sure about the others but I'm assuming it was a thread safety issue.

推荐答案

我最终得到了该项目的工作,但是又试图创建图像以供新实例,重新开放的问题。我不知道为什么它的工作然后停止工作,但我重建我的自定义AMI从头再repushed我的项目。原来它是在 wsgi.py 的问题。我发布的版本是真正从正在部署什么不同。出于某种原因,另一个开发人员已经把这个 wsgi.py

I eventually got the project working but then tried creating an image to use for new instances, which reopened the problem. I'm not sure why it worked then stopped working but I rebuilt my custom AMI from scratch and then repushed my project. Turns out it was an issue in wsgi.py. The version I posted was actually the different from what was being deployed. For some reason another developer had put this in wsgi.py:

path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if path not in sys.path:
sys.path.append(path)

我删除了这一点,它解决了这一问题。

I removed this and it fixed the problem.

我对任何人有意见

Script timed out before returning headers: wsgi.py

是检查你wsgi.py文件。

is to check you wsgi.py file.

更新2015年9月17日

我还是偶尔在这个问题上运行。通常情况下,通过重新部署EB部署修复该问题。这是很难说的根本问题是什么。

I'm still occasionally running in to this issue. Usually, redeploying via eb deploy fixes the issue. It's hard to say what the underlying issue is.

这篇关于弹性豆茎wsgi.py:脚本之前返回头超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆