<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
I have had the same experience as Terry.<br>
<br>
However, I just tried something and it worked!<br>
<br>
<Directory /www/docroot><br>
PythonInterpreter myapp2<br>
PythonPath "blahblabh<br>
SetHandler python-program<br>
PythonHandler mod_python.publisher<br>
PythonDebug On <br>
</Directory><br>
<br>
i.e., use "SetHander python-program" with no following argument ".py",
followed by "PythonHandler with arg of mod_python.publisher"<br>
<br>
Terry MacDonald wrote:<br>
<blockquote type="cite"
cite="mid1084989362.8661.48.camel@bigmac.taumu.com">
<pre wrap="">On Wed, 2004-05-19 at 18:27, Jorey Bump wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I don't need to use the suffix. My httpd.conf looks like this (Debian
Woody: apache 1.3.26, mod_python 2.7.8):
<Directory /var/www/documentroot>
AddHandler python-program .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
I can access function foobar in app.py like this:
<a class="moz-txt-link-freetext" href="http://www.example.com/app/foobar">http://www.example.com/app/foobar</a>
</pre>
</blockquote>
<pre wrap=""><!---->
Well something is different because with this config (i'm not an apache
expert):
(Using Fedora Core 1, apache 2.0.48 and mod_python 3.1.3)
PythonDebug on
<Directory "/var/www/python">
PythonPath "['/var/www/python']+sys.path"
AddHandler mod_python .py
PythonHandler mod_python.publisher
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
my foobar in app.py called as <a class="moz-txt-link-freetext" href="http://localhost/app/foobar">http://localhost/app/foobar</a> gives a 'Not
Found' error while <a class="moz-txt-link-freetext" href="http://localhost/app.py/foobar">http://localhost/app.py/foobar</a> works fine.
This is an ongoing bugbear for me: dropping the .py. Can anyone explain
this odd behaviour, Grisha?
David Geller wrote:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">Hi,
I have been using the publisher handler for development purposes (after
having used the more general handler paradigm previously), and am
considering deployment..
Some questions:
1. Is the publisher suitable for public access, in terms of security, etc.?
</pre>
</blockquote>
<pre wrap="">I'm using it publicly. I'm unaware of any intrinsic security issues. It
will only be as secure as the apps you write.
</pre>
<blockquote type="cite">
<pre wrap="">2. With the publisher, can you store your python programs outside the
document root? (I couldn't figure out a way for this)
</pre>
</blockquote>
<pre wrap="">Yes, but there are different answers to this question. You can place
your files anywhere on the system, and use the Alias directive in your
apache configuration:
Alias /snake/ /var/www/python/
Then you would use this URL:
<a class="moz-txt-link-freetext" href="http://www.example.com/snake/">http://www.example.com/snake/</a>
You can also develop packages and install them in the site-packages
directory alongside other 3rd party packages. Then they will be in your
path for easy importing and sharing among applications. Of course, you
will still need at least one python file to run under apache, but the
bulk of your code will be completely out of the web directory.
</pre>
<blockquote type="cite">
<pre wrap="">3. With publisher, is it possible to hide the ".py" suffix?
</pre>
</blockquote>
<pre wrap="">I don't need to use the suffix. My httpd.conf looks like this (Debian
Woody: apache 1.3.26, mod_python 2.7.8):
<Directory /var/www/documentroot>
AddHandler python-program .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
I can access function foobar in app.py like this:
<a class="moz-txt-link-freetext" href="http://www.example.com/app/foobar">http://www.example.com/app/foobar</a>
</pre>
<blockquote type="cite">
<pre wrap="">4. I guess I would like to know what the publisher is really good for -
it is convenient, but is it just better to code your own handler by hand?
</pre>
</blockquote>
<pre wrap="">I can't imagine why. Publisher is clean and crisp. I love it!
As an example of its convenience, I wrote and tested an entire module on
a Windows machine and copied it to my Linux server. I added a single
function to handle the request from a web page and serve as a frontend
to the rest of the application. I've never encountered that kind of
portability before.
_______________________________________________
Mod_python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Mod_python@modpython.org">Mod_python@modpython.org</a>
<a class="moz-txt-link-freetext" href="http://mailman.modpython.org/mailman/listinfo/mod_python">http://mailman.modpython.org/mailman/listinfo/mod_python</a>
</pre>
</blockquote>
</blockquote>
</body>
</html>