Hi guys,<br><br><div style="margin-left: 40px;">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.<br>
<br>---app codes (test.py)---<br>import simplejson<br>def application(env, start_response):<br> output = simplejson.dumps({'foo': 'bar'})<br> start_response('200 OK', [('Content-Type', 'text/html')])<br>
return [output]<br><br>---uwsgi config---<br><uwsgi><br> <socket>/tmp/uwsgi.sock</socket><br> <master/><br> <memory-report/><br> <processes>1</processes><br> <max-requests>10</max-requests><br>
<listen>100</listen><br> <python-path>/home/kenny/test_project</python-path><br> <daemonize>/home/kenny/test_project/logs/uwsgi.log</daemonize><br> <app mountpoint="/script"><br>
<script>test</script><br> </app><br></uwsgi><br><br>---command running uwsgi---<br>uwsgi -x /home/kenny/test_project/uwsgi_config.xml --pidfile /home/kenny/test_project/uwsgi.pid<br><br>
---apache config---<br>NameVirtualHost myhost.mydomain:18899<br><VirtualHost myhost.mydomain:18899><br> ErrorLog "/home/kenny/test_project/logs/error_log"<br> CustomLog "/home/kenny/test_project/logs/access_log" common<br>
<br> <Location "/script"><br> SetHandler uwsgi-handler<br> uWSGIsocket /tmp/uwsgi.sock<br> </Location><br></VirtualHost><br><br>---logs for handling post request to '<a href="http://myhost.mydomain:18899/script">http://myhost.mydomain:18899/script</a>' with post data "foo=bar" ---<br>
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)<br>
error_log==>[Fri Jul 30 20:52:55 2010] [error] [client xxx.xxx.xxx.xxx] uwsgi: recv() Connection reset by peer<br>access_log==>xxx.xxx.xxx.xxx - - [30/Jul/2010:20:52:55 +0800] "POST /script/ HTTP/1.1" 500 599<br>
<br><br>Anybody can tell me what is wrong? <br><br></div>kenny<br>