INGInious
INGInious copied to clipboard
FastCGI detection breaks Gunicorn and other WSGI servers
These lines in inginious-webapp do not work properly:
if 'SERVER_SOFTWARE' in os.environ: # cgi
os.environ['FCGI_FORCE_CGI'] = 'Y'
if 'PHP_FCGI_CHILDREN' in os.environ or 'SERVER_SOFTWARE' in os.environ: # lighttpd fastcgi
print(os.environ)
import flup.server.fcgi as flups
flups.WSGIServer(application, multiplexed=True, bindAddress=None, debug=False).run()
Gunicorn is a WSGI server but defines SERVER_SOFTWARE
, and a such we start the flup FCGI server.
As already mentioned, I think the inginious-webapp
script should take an additional argument to make the protocol explicit.
Making WSGI the default is the best way; like that, the code can be imported from any python code and work as-is. Adding a cmd arg --cgi
would be enough I think.