2013-12-17 14 views
2

由於某些原因,有時當用戶上傳圖片時,我不斷收到500錯誤,我無法重現在我自己的。我可以在我的Django /阿帕奇/ WSGI日誌中看到的唯一的事情是這樣的:「從iOS設備上傳Django中的圖片時,在標題前輸出腳本結尾:wsgi.py」

[核心:錯誤] [PID 17191]頭前的腳本輸出的結束:wsgi.py

我不知道在哪裏開始...

編輯#1

我改變了我的LogLevel的調試和我有以下幾點:

[Tue Dec 17 14:11:46.600635 2013] [proxy:debug] [pid 29456] proxy_util.c(1734): AH00927: initializing worker proxy:reverse local 
[Tue Dec 17 14:11:46.600709 2013] [proxy:debug] [pid 29456] proxy_util.c(1785): AH00931: initialized single connection worker in child 29456 for (*) 
[Tue Dec 17 14:11:46.600788 2013] [:info] [pid 29456] mod_wsgi (pid=29456): Initializing Python. 
[Tue Dec 17 14:11:46.608906 2013] [:info] [pid 29455] mod_wsgi (pid=29455): Starting process 'poka' with uid=48, gid=48 and threads=15. 
[Tue Dec 17 14:11:46.609425 2013] [:info] [pid 29455] mod_wsgi (pid=29455): Initializing Python. 
[Tue Dec 17 14:11:46.612573 2013] [proxy:debug] [pid 29457] proxy_util.c(1694): AH00925: initializing worker proxy:reverse shared 
[Tue Dec 17 14:11:46.612627 2013] [proxy:debug] [pid 29457] proxy_util.c(1734): AH00927: initializing worker proxy:reverse local 
[Tue Dec 17 14:11:46.612698 2013] [proxy:debug] [pid 29457] proxy_util.c(1785): AH00931: initialized single connection worker in child 29457 for (*) 
[Tue Dec 17 14:11:46.612779 2013] [:info] [pid 29457] mod_wsgi (pid=29457): Initializing Python. 
[Tue Dec 17 14:11:46.616459 2013] [proxy:debug] [pid 29458] proxy_util.c(1694): AH00925: initializing worker proxy:reverse shared 
[Tue Dec 17 14:11:46.616511 2013] [proxy:debug] [pid 29458] proxy_util.c(1734): AH00927: initializing worker proxy:reverse local 
[Tue Dec 17 14:11:46.616574 2013] [proxy:debug] [pid 29458] proxy_util.c(1785): AH00931: initialized single connection worker in child 29458 for (*) 
[Tue Dec 17 14:11:46.616644 2013] [:info] [pid 29458] mod_wsgi (pid=29458): Initializing Python. 
[Tue Dec 17 14:11:46.630974 2013] [proxy:debug] [pid 29459] proxy_util.c(1694): AH00925: initializing worker proxy:reverse shared 
[Tue Dec 17 14:11:46.631046 2013] [proxy:debug] [pid 29459] proxy_util.c(1734): AH00927: initializing worker proxy:reverse local 
[Tue Dec 17 14:11:46.631116 2013] [proxy:debug] [pid 29459] proxy_util.c(1785): AH00931: initialized single connection worker in child 29459 for (*) 
[Tue Dec 17 14:11:46.631195 2013] [:info] [pid 29459] mod_wsgi (pid=29459): Initializing Python. 
[Tue Dec 17 14:11:46.664817 2013] [mpm_prefork:notice] [pid 29453] AH00163: Apache/2.4.6 (Amazon) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations 
[Tue Dec 17 14:11:46.664879 2013] [mpm_prefork:info] [pid 29453] AH00164: Server built: Sep 20 2013 18:01:06 
[Tue Dec 17 14:11:46.664901 2013] [core:notice] [pid 29453] AH00094: Command line: '/usr/sbin/httpd' 
[Tue Dec 17 14:11:46.664939 2013] [mpm_prefork:debug] [pid 29453] prefork.c(995): AH00165: Accept mutex: sysvsem (default: sysvsem) 
[Tue Dec 17 14:11:46.668668 2013] [proxy:debug] [pid 29460] proxy_util.c(1694): AH00925: initializing worker proxy:reverse shared 
[Tue Dec 17 14:11:46.668748 2013] [proxy:debug] [pid 29460] proxy_util.c(1734): AH00927: initializing worker proxy:reverse local 
[Tue Dec 17 14:11:46.668832 2013] [proxy:debug] [pid 29460] proxy_util.c(1785): AH00931: initialized single connection worker in child 29460 for (*) 
[Tue Dec 17 14:11:46.668921 2013] [:info] [pid 29460] mod_wsgi (pid=29460): Initializing Python. 
[Tue Dec 17 14:11:46.685523 2013] [:info] [pid 29455] mod_wsgi (pid=29455): Attach interpreter ''. 
[Tue Dec 17 14:11:46.685687 2013] [:info] [pid 29455] mod_wsgi (pid=29455): Adding '/srv/www/poka/app/poka' to path. 
[Tue Dec 17 14:11:46.685955 2013] [:info] [pid 29455] mod_wsgi (pid=29455): Adding '/srv/www/poka/app/env/main/lib/python2.7/site-packages' to path. 
[Tue Dec 17 14:11:46.694283 2013] [:info] [pid 29458] mod_wsgi (pid=29458): Attach interpreter ''. 
[Tue Dec 17 14:11:46.695044 2013] [:info] [pid 29456] mod_wsgi (pid=29456): Attach interpreter ''. 
[Tue Dec 17 14:11:46.698253 2013] [:info] [pid 29457] mod_wsgi (pid=29457): Attach interpreter ''. 
[Tue Dec 17 14:11:46.702979 2013] [:info] [pid 29459] mod_wsgi (pid=29459): Attach interpreter ''. 
[Tue Dec 17 14:11:46.711173 2013] [:info] [pid 29460] mod_wsgi (pid=29460): Attach interpreter ''. 

EDIT#2我wsgi.py

""" 

This module contains the WSGI application used by Django's development server 
and any production WSGI deployments. It should expose a module-level variable 
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover 
this application via the ``WSGI_APPLICATION`` setting. 

Usually you will have the standard Django WSGI application here, but it also 
might make sense to replace the whole Django WSGI application with a custom one 
that later delegates to the Django one. For example, you could introduce WSGI 
middleware here, or combine a Django application with an application of another 
framework. 

""" 
import os 

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.prod") 

# This application object is used by any WSGI server configured to use this 
# file. This includes Django's development server, if the WSGI_APPLICATION 
# setting points here. 
import djcelery 
from django.core.wsgi import get_wsgi_application 
djcelery.setup_loader() 
_application = get_wsgi_application() 

env_variables_to_pass = ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY'] 

def application(environ, start_response): 
    # pass the WSGI environment variables on through to os.environ 
    for var in env_variables_to_pass: 
     os.environ[var] = environ.get(var, '') 
    return _application(environ, start_response) 

EDIT#3:從日誌/ error_log中日誌

[Thu Dec 19 18:05:58.247406 2013] [auth_digest:notice] [pid 1733] AH01757: generating secret for digest authentication ... 
[Thu Dec 19 18:05:58.248882 2013] [lbmethod_heartbeat:notice] [pid 1733] AH02282: No slotmem from mod_heartmonitor 
[Thu Dec 19 18:05:58.300894 2013] [ssl:warn] [pid 1733] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366) 
[Thu Dec 19 18:05:58.591912 2013] [mpm_prefork:notice] [pid 1733] AH00163: Apache/2.4.6 (Amazon) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations 
[Thu Dec 19 18:05:58.591987 2013] [core:notice] [pid 1733] AH00094: Command line: '/usr/sbin/httpd' 
[Thu Dec 19 18:06:09.626354 2013] [core:notice] [pid 1733] AH00052: child pid 1735 exit signal Segmentation fault (11) 
[Thu Dec 19 19:31:42.719739 2013] [:error] [pid 1755] (70007)The timeout specified has expired: [client 96.33.249.142:49830] mod_wsgi (pid=1755): Unable to get bucket brigade for request. 
[Thu Dec 19 19:31:43.195999 2013] [:error] [pid 1769] [client 96.33.249.142:29054] mod_wsgi (pid=1769): Exception occurred processing WSGI script '/srv/www/poka/app/poka/apache/wsgi.py'. 
[Thu Dec 19 19:31:43.196140 2013] [:error] [pid 1769] [client 96.33.249.142:29054] IOError: failed to write data 
+0

您確定您沒有將其作爲CGI運行嗎? –

+0

我怎麼知道? (對於noob問題抱歉..)一切都很好,只是偶爾,隨機地,上傳失敗,無處不在。 – abisson

+0

你可以發佈你的'wsgi.py'的實現嗎? –

回答

1

當我有這個錯誤是因爲我被雖然發送多部分數據發佈,並通過更改<form method="POST"><form method="POST" enctype="multipart/form-data">來修復它