[uWSGI] got 500 when handling POST request with post-data

景俊吕 kennylanse at gmail.com
Fri Jul 30 15:23:54 CEST 2010


Hi guys,

I setup an environment with uwsgi + apache and mount my app on it. The app
simply returns a json string. It handles GET req and POST req (without any
post-data) properly, but returns 500 when there is data posted to it. The
app codes and all configurations are list below.

---app codes (test.py)---
import simplejson
def application(env, start_response):
    output = simplejson.dumps({'foo': 'bar'})
    start_response('200 OK', [('Content-Type', 'text/html')])
    return [output]

---uwsgi config---
<uwsgi>
    <socket>/tmp/uwsgi.sock</socket>
    <master/>
    <memory-report/>
    <processes>1</processes>
    <max-requests>10</max-requests>
    <listen>100</listen>
    <python-path>/home/kenny/test_project</python-path>
    <daemonize>/home/kenny/test_project/logs/uwsgi.log</daemonize>
    <app mountpoint="/script">
        <script>test</script>
    </app>
</uwsgi>

---command running uwsgi---
uwsgi -x /home/kenny/test_project/uwsgi_config.xml --pidfile
/home/kenny/test_project/uwsgi.pid

---apache config---
NameVirtualHost myhost.mydomain:18899
<VirtualHost myhost.mydomain:18899>
    ErrorLog "/home/kenny/test_project/logs/error_log"
    CustomLog "/home/kenny/test_project/logs/access_log" common

    <Location "/script">
        SetHandler uwsgi-handler
        uWSGIsocket /tmp/uwsgi.sock
    </Location>
</VirtualHost>

---logs for handling post request to 'http://myhost.mydomain:18899/script'
with post data "foo=bar" ---
uwsgi.log==> {address space usage: 10096640 bytes/9MB} {rss usage: 3244032
bytes/3MB} [pid: 7736|app: 1|req: 4/4] xxx.xxx.xxx.xxx () {42 vars in 1477
bytes} [Fri Jul 30 21:02:54 2010] POST /script/ => generated 14 bytes in 0
msecs (HTTP/1.1 200) 1 headers in 44 bytes (0 async switches on async core
0)
error_log==>[Fri Jul 30 20:52:55 2010] [error] [client xxx.xxx.xxx.xxx]
uwsgi: recv() Connection reset by peer
access_log==>xxx.xxx.xxx.xxx - - [30/Jul/2010:20:52:55 +0800] "POST /script/
HTTP/1.1" 500 599


Anybody can tell me what is wrong?

kenny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.unbit.it/pipermail/uwsgi/attachments/20100730/6c9c730c/attachment.htm 


More information about the uWSGI mailing list