[mod_python] CGI versus *real* mod_python?

Jorey Bump list+mod_python at joreybump.com
Mon Apr 12 15:20:24 EST 2004

Charles Stevenson wrote:

> On Sun, Apr 11, 2004 at 10:53:31PM -0700, Erik Stephens wrote:
>>No, what you have there will use mod_python.  What Jorey was trying to
>>get at (I think) was that maybe all of the files in /cgi-bin will be
>>treated as CGIs since that is a common web server configuration.


> Actually I think what he was trying to get at is that mod_python unlike
> cgi doesn't require the scripts to reside in any certain directory. 

Also true. When someone mentions cgi-bin, it's a flag that there might
be misconceptions (or misconfigurations) at play.

> You
> could for example create /~user/python-bin or something if you didn't
> like the idea of intermixing your scripts with your html although I
> don't see the point. If you want your scripts to reside in a specific
> directory you should add a ptyhon path entry via htaccess so that 
> mod_python knows where it might find your modules. 

Although I rarely do it, sometimes it's helpful to put code in a
separate, aliased directory to protect it from designers and their
"intelligent" web development suites. Also, I doubt if many are
preconfigured to transfer .py files in ASCII mode.

> I don't think any
> server is configured to treat all file within cgi-bin as CGI. The reason
> for a separate directory afaik is to restrict the scope of ExecCGI.
> Correct me if I'm wrong. :)

It depends on how you configure your web server. I almost always use a
ScriptAlias with apache, which *does* treat every file in the directory
as CGI. However, you may want all of your application files to reside in
one directory, and ExecCGI allows you to that.

More information about the Mod_python mailing list