Uwsgi returns empty output

I have nginx and uwsgi installed on a CentOS 6 server. When I send some data to a web server, it is processed correctly, but the result is not returned. If I print the generated html just before the application before the application function returns it, the HTML will display correctly in the console, but the following line in the console:

[pid: 31650|app: 0|req: 2/2] <server ip> () {48 vars in 873 bytes} [Mon Sep 15 18:19:45 2014] POST / => generated 0 bytes in 10583 msecs (HTTP/1.1 200) 1 headers in 44 bytes (418 switches on core 0)

I increased the socket timeout but it doesn’t matter.

EDIT: I applied a weird workaround for this. My html was stored in the "html" variable. I changed my code:

return [html] #This would not return any output even though 'print html' was fine

To:

open('/tmp/ot.txt', 'w').write(html)
d = open('/tmp/ot.txt').read()
return [d] #This works!

I would prefer not to use my workaround. Any ideas why this works, but the original is not. Python version - 2.6.6

+4
source share
2

WSGI (python2/3) (python2). Unicode , / , , :

https://github.com/unbit/uwsgi/issues/556

+4

, , uwsgi . , , , write() unicode ascii- ( , - ord(x) > 127), read() .

return [html.encode('utf8')] , .

, markdown.markdown(text) .md .html . HTML, , Unicode.

+3

All Articles