0

I'm currently moving all my Python CGI scripts to WSGI standard using Flup (http://trac.saddi.com/flup), I created a dispatch.fcgi file calling and using Flup as described in the documentation:

from flup.server.fcgi import WSGIServer
...

and works like a charm, the problem comes when I try to switch to CGI to debug something in non-cached mode, avoiding to kill processes or touch files, this should be as simple as replace the Flup server to import:

from flup.server.cgi import WSGIServer
...

but then the browser returns me a 500 error, I checked the headers and html executing through SSH and seems to be ok, then I figured should be some server misconfiguration (Dreamhost shared) and I discover the server is not able to execute Python scripts with .fcgi extension, so I found a workaround adding this to .htaccess file:

AddHandler cgi-script .fcgi

then the CGI mode almost works (wsgi.input is always empty, even reading it in a proper way passing the length) but FCGI caching doesn't works at all, starting a lot of processes. At this moment I'm totally deadlocked, I just want a simple way to switch from FCGI to CGI, is this method valid? or I'm missing something?

Thanks a lot.

Htechno
  • 5,901
  • 4
  • 27
  • 37

1 Answers1

1

FCGI protocol is different from CGI. That's why the simple change from FCGI to CGI didn't work and the FCGI would not work when changing the Apache .fcgi file handler to CGI handler.

edgars
  • 1,038
  • 1
  • 7
  • 17
  • I know there are different protocols, but under WSGI both should work in the same way, at least I understand this is the rationale of WSGI, unify all the protocols under the same wrapper. If Flup cannot handle CGI for why is the CGI module of Flup? There are a lot of people using it in this way... – Htechno Dec 10 '10 at 05:43
  • Theoretically the scripts should work in CGI mode after your actions. Why don't they, I don't know, but I'm answering that you can't just expect all fcgi scripts to work as cgi and vice versa. There cannot be a simple way to switch, at least not the one you are trying. – edgars Dec 10 '10 at 10:08