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

Tim Johnson tim at johnsons-web.com
Sun Oct 31 00:08:00 CEST 2010

* Evert Rol <evert.rol at gmail.com> [101030 13:23]:
> > 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.
 That's the keyword - 'mod_wsgi' 
> But the easiest way to find out is to try it out, right?
 I did, didn't work.  

> 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.
  Understood. Thanks 

tim at johnsons-web.com or akwebsoft.com

More information about the Tutor mailing list