Il giorno 05/set/2011, alle ore 12:17, Walter Wefft ha scritto:
> Hello,
>
> I'm not sure this has anything to with uwsgi, but maybe someone could advise
> me in any case.
>
> I have a nginx -> uwsgi -> Django setup and having trouble tracking down a
> 502/Bad Gateway which occurs whenever the Django DEBUG setting is False, but
> not when it is True.
>
> The app has the idea of Folders and Documents and, given a Directory url,
> displays a list of Documents. But if there is only one Document, I do a
> redirect to the Document url:
>
> from django.shortcuts import redirect
>
> ...
> documents = category.documents.filter(hidden=False)
> if len(documents) == 1:
> url = documents[0].get_absolute_url()
> print 'REQUEST: ' + request.path
> print 'REDIRECT: ' + url
> return redirect(url)
>
> This works with the Django dev server with DEBUG on or off, and (as said)
> works with nginx/uwsgi when DEBUG is on.
>
> The nginx.conf:
>
> location / {
> set $memcached_key $uri;
> memcached_pass 127.0.0.1:11211;
> default_type text/html;
> error_page 404 502 = @djangoapp;
> }
>
> location @djangoapp {
> uwsgi_pass unix:/www/djangoapp/run/uwsgi.sock;
> include /www/djangoapp/nginx/1.0.6/conf/uwsgi_params;
> }
>
> The uwsgi version is 0.9.9, Django is 1.3 and the error is:
>
> supervisor> fg djangoapp
>
> REQUEST: /python/web/tornado/
>> REDIRECT: /python/web/tornado/tornado
>> [pid: 9606|app: 0|req: 1/1] X.X.X.X () {42 vars in 806 bytes} [Mon Sep 5
>> 04:31:12 2011] GET /python/web/tornado/ => generated 0 bytes in 227 msecs
>> (HTTP/1.1 302) 2 headers in 120 bytes (1 switches on core 0)
>> SIGPIPE: writing to a closed pipe/socket/fd (probably the client
>> disconnected) on request /python/web/tornado/tornado (ip X.X.X.X) !!!
>> [pid: 9605|app: 0|req: 1/2] X.X.X.X () {42 vars in 820 bytes} [Mon Sep 5
>> 04:31:12 2011] GET /python/web/tornado/tornado => generated 39 bytes in 256
>> msecs (HTTP/1.1 500) 1 headers in 78 bytes (1 switches on core 0)
>>
>
>
It looks like django is raising some exception.
Have you enabled console logging in django ? (this will allows you to get
django errors in the uWSGI logs)
--
Roberto De Ioris
http://unbit.it
JID: [email protected]
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi