[mod_python] Mod_Python and RewriteRule

Nathan C. Tresch nathan at yapta.com
Wed Apr 11 18:56:24 EDT 2007


Yes,  /user/trip.myt?tab=airline&id=18335 works.

    AddHandler mod_python .py
    AddHandler mod_python .myt
    PythonHandler myghty.ApacheHandler::handle
    PythonPath "[r'/usr/local/data/wwwdev/ntresch']+sys.path"
    PythonOption MyghtyInterpreterName r"ntresch_interp"
    PythonOption MyghtyComponentRoot \
    "[  \
        {'components':'/data/wwwdev/ntresch/public'}, \
        {'templates':'/data/wwwdev/ntresch/myghty/templates'} \
    ]"
    PythonOption MyghtyDataDir r"/data/wwwdev/ntresch/myghty/data"


    #PythonHandler mod_python.publisher
    PythonDebug On

These lines are located in the main apache config file.

On 4/11/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
>
> Does using:
>
>   /user/trip.myt?tab=airline&id=18335
>
> in the browser work?
>
> What is the Apache configuration snippet you are using to enable
> mod_python for this URL? Where is it located, main Apache
> configuration or .htaccess file?
>
> Graham
>
> On 12/04/07, Nathan C. Tresch <nathan at yapta.com> wrote:
> > So, here is what I get:
> >
> > %tail -f rewrite_log
> > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [
> > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial ] (2) init
> > rewrite engine with requested uri /trip-18335/Minneapolis/St.
> > Paul/Washington/
> > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [
> > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial] (3)
> > applying pattern '/trip-([0-9]*)/.*/' to uri
> '/trip-18335/Minneapolis/St.
> > Paul/Washington/'
> >  67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [
> > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial] (2) rewrite
> > '/trip-18335/Minneapolis/St. Paul/Washington/' ->
> > '/user/trip.myt?tab=airline&id=18335'
> > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [
> > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial] (3) split
> > uri=/user/trip.myt?tab=airline&id=18335 ->
> > uri=/user/trip.myt, args=tab=airline&id=18335
> > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [
> > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial] (2) local
> > path result: /user/trip.myt
> > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [
> > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial] (2)
> > prefixed with document_root to
> > /usr/local/data/wwwdev/ntresch/public/user/trip.myt
> > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [
> > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial] (1)
> > go-ahead with
> > /usr/local/data/wwwdev/ntresch/public/user/trip.myt [OK]
> >
> > Yet my browser still gives me a 404.
> >
> > I suspect it's because python/myghty is looking for something in the
> > origional path, it's modules maybe?  And it can't find anything there.
> >
> >
> >  On 4/11/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
> > > On 12/04/07, Nathan C. Tresch <nathan at yapta.com> wrote:
> > > > We're using Myghty and Mod_Python.  The following RewriteRule
> produces a
> > > > 404:
> > > >
> > > > RewriteRule /trip-([0-9]*)/.*/
> > > > /user/trip.myt\?tab=airlines&id=$1 [L]
> > > >
> > > > Previously, before we converted to PHP, the rule looked like this:
> > > >
> > > > RewriteRule /trip-([0-9]*)/.*/
> > > > /user/trip.php\?tab=airlines&id=$1 [L]
> > > >
> > > > This worked.
> > > >
> > > > Can anyone tell me what gives?
> > >
> > > Have you tried debugging what mod_rewrite is doing by increasing its
> > > logging output using the RewriteLogLevel directive etc? From that you
> > > can see what it finally rewrites it to. You can then try putting that
> > > URL into the browser directly and try and work out why any other
> > > configuration may not be correct.
> > >
> > > Graham
> > >
> >
> >
> >
> > --
> > Nathan C. Tresch
> > Software Engineer
> > YapTA! Inc.
>



-- 
Nathan C. Tresch
Software Engineer
YapTA! Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070411/4ce3bf74/attachment.html


More information about the Mod_python mailing list