[mod_python] questions about mod_python publisher

David Geller dg at sponsera.com
Wed May 19 15:24:29 EDT 2004


I have had the same experience as Terry.

However, I just tried something and it worked!

 <Directory /www/docroot>
      PythonInterpreter myapp2
    PythonPath "blahblabh
    SetHandler python-program
    PythonHandler mod_python.publisher
    PythonDebug On
  </Directory>

i.e., use "SetHander python-program" with no following argument ".py", 
followed by "PythonHandler with arg of mod_python.publisher"

Terry MacDonald wrote:

>On Wed, 2004-05-19 at 18:27, Jorey Bump wrote:
>  
>
>>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:
>>
>>  http://www.example.com/app/foobar
>>    
>>
>
>
>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 http://localhost/app/foobar gives a 'Not
>Found' error while http://localhost/app.py/foobar works fine.
>
>This is an ongoing bugbear for me: dropping the .py.  Can anyone explain
>this odd behaviour, Grisha?
>
>
>David Geller wrote:
>  
>
>>>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.?
>>>      
>>>
>>I'm using it publicly. I'm unaware of any intrinsic security issues. It 
>>will only be as secure as the apps you write.
>>
>>    
>>
>>>2. With the publisher, can you store your python programs outside the 
>>>document root? (I couldn't figure out a way for this)
>>>      
>>>
>>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:
>>
>>  http://www.example.com/snake/
>>
>>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.
>>
>>    
>>
>>>3. With publisher, is it possible to hide the ".py" suffix?
>>>      
>>>
>>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:
>>
>>  http://www.example.com/app/foobar
>>
>>    
>>
>>>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?
>>>      
>>>
>>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
>>Mod_python at modpython.org
>>http://mailman.modpython.org/mailman/listinfo/mod_python
>>    
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://modpython.org/pipermail/mod_python/attachments/20040519/b9790f51/attachment.html


More information about the Mod_python mailing list