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({&#39;foo&#39;: &#39;bar&#39;})<br>    start_response(&#39;200 OK&#39;, [(&#39;Content-Type&#39;, &#39;text/html&#39;)])<br>
    return [output]<br><br>---uwsgi config---<br>&lt;uwsgi&gt;<br>    &lt;socket&gt;/tmp/uwsgi.sock&lt;/socket&gt;<br>    &lt;master/&gt;<br>    &lt;memory-report/&gt;<br>    &lt;processes&gt;1&lt;/processes&gt;<br>    &lt;max-requests&gt;10&lt;/max-requests&gt;<br>
    &lt;listen&gt;100&lt;/listen&gt;<br>    &lt;python-path&gt;/home/kenny/test_project&lt;/python-path&gt;<br>    &lt;daemonize&gt;/home/kenny/test_project/logs/uwsgi.log&lt;/daemonize&gt;<br>    &lt;app mountpoint=&quot;/script&quot;&gt;<br>
        &lt;script&gt;test&lt;/script&gt;<br>    &lt;/app&gt;<br>&lt;/uwsgi&gt;<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>&lt;VirtualHost myhost.mydomain:18899&gt;<br>    ErrorLog &quot;/home/kenny/test_project/logs/error_log&quot;<br>    CustomLog &quot;/home/kenny/test_project/logs/access_log&quot; common<br>
    <br>    &lt;Location &quot;/script&quot;&gt;<br>        SetHandler uwsgi-handler<br>        uWSGIsocket /tmp/uwsgi.sock<br>    &lt;/Location&gt;<br>&lt;/VirtualHost&gt;<br><br>---logs for handling post request to &#39;<a href="http://myhost.mydomain:18899/script">http://myhost.mydomain:18899/script</a>&#39; with post data &quot;foo=bar&quot; ---<br>
uwsgi.log==&gt; {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/ =&gt; 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==&gt;[Fri Jul 30 20:52:55 2010] [error] [client xxx.xxx.xxx.xxx] uwsgi: recv() Connection reset by peer<br>access_log==&gt;xxx.xxx.xxx.xxx - - [30/Jul/2010:20:52:55 +0800] &quot;POST /script/ HTTP/1.1&quot; 500 599<br>
<br><br>Anybody can tell me what is wrong? <br><br></div>kenny<br>