[Tutor] possible to run a python script from non-cgi?

Evert Rol evert.rol at gmail.com
Sat Oct 30 23:15:54 CEST 2010

> FYI: I am working in a linux environment with python 2.6.5
> am an experienced web developer with 8 years in python, but
> :) I have never tried this trick before:
> I note that with the right .htaccess file, I can run a php file,
> from a non-cgi location.
> Example: On my machine, my wwwroot is at /home/http/, I have
> /home/http/php/test/index.php and I have run index.php as
> http://localhost/php/test/ (again with the correct .hataccess).
> Is it possible to run a python script this way?

I wouldn't think so, because index.php is not run as a cgi-script. 
Whether Python will be interpreted correctly depends entirely on the configuration of your webserver, in particular whether you're using/loading the correct modules.
But if configured correctly, yes, you can 'run' Python scripts. Mod_wsgi arranges this for you, and this is generally how things like Django run.

But the easiest way to find out is to try it out, right?

I also guess this question might be better answered on the forum corresponding to your webserver (Apache?), since it appears to deal more with the server setup than actually with Python.

Those are my best guesses/ideas.



More information about the Tutor mailing list