Fwd: [mod_python] other file than .py

Graham Dumpleton grahamd at dscpl.com.au
Mon Jun 26 02:45:44 EDT 2006


Please keep followups on mailing list, don't send them just to me.


In your main config change it to:

 <Directory /var/www/public_html>
         AllowOverride FileInfo AuthConfig Limit
         Options Indexes SymLinksIfOwnerMatch IncludesNoExec MultiViews
 </Directory>

and drop "Options" directive from .htaccess.

Otherwise, change main config to use:

 <Directory /var/www/public_html>
         AllowOverride All
         Options Indexes SymLinksIfOwnerMatch IncludesNoExec MultiViews
 </Directory>

In other words, the permissions are such that you can't enable
MultiViews in .htaccess context as main configuration wasn't
allowing it. You therefore need to allow override for everything,
or work out what specific override value is to allow that option
to be set from .htaccess file.

Graham  

elekis wrote ..
> sorry I forgot to say.
> 
> for version
> 
> Apache/2.0.55 (Ubuntu) mod_python/3.1.4 Python/2.4.3 PHP/5.1.2 Server
> at localhost Port 80
> 
> 
> for the log.
> 
> it is what he put in /var/log/apache2/error.log
> 
> [Mon Jun 26 07:56:05 2006] [alert] [client 127.0.0.1]
> /var/www/public_html/.htaccess: Options not allowed here
> 
> and in apache2/access.log
> 
> 127.0.0.1 - - [26/Jun/2006:07:56:05 +0200] "GET /public_html/add_event
> HTTP/1.1" 500 654 "-" "Mozilla/5.0 (X11; U; Linux i686; fr;
> rv:1.8.0.4) Gecko/20060608 Ubuntu/dapper-security Firefox/1.5.0.4"
> 
> 
> is there any others log elsewhere??
> 
> 
> thanks a lot.
> 
> a+++
> 
> 
> 
> 
> On 6/26/06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
> > But what error message is being logged in the Apache error_log file
> > when this occurs? It should give you some indication of what the
> > problem is.
> >
> > Also, what version of mod_python/Apache are you using?
> >
> > elekis wrote ..
> > > a in fact I always has a 500 error.
> > >
> > >
> > > so there here all file.
> > >
> > > .htaccess (thanks Dumpleton)
> > > -----------------------------------------------------------
> > >
> > > AddHandler mod_python .py
> > > PythonHandler mod_python.publisher
> > > PythonDebug On
> > >
> > > <Files *.pyc>
> > > deny from all
> > > </Files>
> > >
> > > Options +MultiViews
> > > MultiviewsMatch Handlers
> > >
> > > AddType text/html;qs=1.0 .py
> > > AddType text/html;qs=0.9 .html
> > > AddType text/plain;qs=0.8 .txt
> > >
> > > DirectoryIndex index.py
> > >
> > >
> > > -----------------------------------
> > > there is my add_event.py
> > >
> > > def index(req):
> > >       s = """
> > >               <html>
> > >                       <head>
> > >                       <link rel="stylesheet" type= "text/css" href="./add_event.css">
> > >                       </head>
> > >                       <body>
> > >                       <div>ceci est un div</div>"""
> > >       return s + """<h6>Ici H6 est le s&eacute;lecteur de ce paragraphe
> en vert
> > > :
> > >                       Enfin un gain de poids non n&eacu44444444444444444444te;gligeable
> est
> > > souvent
> > >                       obtenu par ce langage, bien que le d&eacute;tail
> du contenu soit $
> > >                       aussi un &eacute;l&eacute;ment qui va plus ou
> moins modifier ce gain.
> > > </h6>
> > >                       </body>
> > >                       </html>
> > >                       """
> > >
> > > -------------------------------------------------------------
> > >
> > > and there is  the directory tag in the apache2.conf
> > >
> > > <Directory /var/www/public_html>
> > >         AllowOverride FileInfo AuthConfig Limit
> > >         Options Indexes SymLinksIfOwnerMatch IncludesNoExec
> > > </Directory>
> > > -----------------------------------------------------------------------
> > > I trie with this adress (the public_html is a simple directory it's
> just
> > > for me
> > >
> > > http://localhost/public_html/add_event
> > >
> > > thanks a lot
> > >
> > >
> > >
> > >
> > > ---------- Forwarded message ----------
> > > From: elekis <elekis at gmail.com>
> > > Date: Jun 20, 2006 8:41 AM
> > > Subject: Re: [mod_python] other file than .py
> > > To: Graham Dumpleton <grahamd at dscpl.com.au>
> > >
> > >
> > > thanks a lot
> > >
> > >
> > > On 6/20/06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
> > > > elekis wrote ..
> > > > > hi,
> > > > >
> > > > > I continue my little way in the magic world of python script under
> > > web
> > > > > and after installeing, testing and begin really to program a
> > > > > interractive site , I confronted with a little problem. I cannot
> touch
> > > > > other file than .py
> > > > >
> > > > > exemple. there is my .htaccess
> > > > >
> > > > > ----------------------------------
> > > > > SetHandler mod_python
> > > > > PythonHandler mod_python.publisher
> > > > > PythonDebug On
> > > > > ----------------------------------
> > > > >
> > > > >
> > > > > here is my event.css
> > > > >
> > > > > --------------------------------
> > > > > h6 { font-size: 50pt ; }
> > > > > -------------------------------
> > > > > but when he trie to load the event.css I have a 500 error
> > > > >
> > > > > -->http://localhost/public_html/add_event.css and it's the same
> thing
> > > > > for other file. is there a thing than I must put on my htacces???
> > > >
> > > > Use "AddHandler" instead of "SetHandler" directive. For example:
> > > >
> > > >   AddHandler mod_python .py
> > > >   PythonHandler mod_python.publisher
> > > >
> > > > What this says is that only requests with a .py in URL will be routed
> > > > through to mod_python.publisher and not every request in that
> > > > directory. This will allow you to place .css, .html, .jpg, .gif,
> etc
> > > files
> > > > in the same directory.
> > > >
> > > > Depending on which version of mod_python you are using, you should
> > > > also use:
> > > >
> > > >   <Files *.pyc>
> > > >   deny from all
> > > >   </Files>
> > > >
> > > > For older versions of mod_python this will ensure that compiled Python
> > > > byte code files are not downloadable. In mod_python 3.2.X these byte
> > > > code files are no longer generated for mod_python.publisher but can
> > > > for basic handlers, but still good to use it regardless.
> > > >
> > > > > other thing. I very like the publisher mod.  cause we
> > > > > http://localhost/public_html/balbla/ link (and that 's cool.
> > > >
> > > > If you are talking about the ability to not have .py in the URL,
> ie the
> > > > multiviews feature of Apache, then you also need to include additional
> > > > configuration to get it to work when using the AddHandler directive.
> > > > These additional directives are:
> > > >
> > > >   Options +MultiViews
> > > >   MultiviewsMatch Handlers
> > > >
> > > >   AddType text/html;qs=1.0 .py
> > > >   AddType text/html;qs=0.9 .html
> > > >   AddType text/plain;qs=0.8 .txt
> > > >
> > > > If you don't have this, you will find that you can't leave off the
> .py
> > > > in the URL. Note that you may have to have Apache 2.0 and most
> > > > recent version of mod_python (3.2.X) for this all to work properly.
> > > >
> > > > One last issue with using "AddHandler" over "SetHandler". When
> > > > using "SetHandler", mod_python.publisher will automatically map
> > > > a request against a directory to the 'index.py' file in the directory.
> > > > When using "AddHandler" this will not happen by default. If you
> > > > want this to happen, you must also include:
> > > >
> > > >   DirectoryIndex index.py
> > > >
> > > > This will cause Apache to take 'index.py' as a candidate index
> > > > directory when request is against the directory.
> > > >
> > > > In summary, use the configuration:
> > > >
> > > >   AddHandler mod_python .py
> > > >   PythonHandler mod_python.publisher
> > > >   PythonDebug On
> > > >
> > > >   <Files *.pyc>
> > > >   deny from all
> > > >   </Files>
> > > >
> > > >   Options +MultiViews
> > > >   MultiviewsMatch Handlers
> > > >
> > > >   AddType text/html;qs=1.0 .py
> > > >   AddType text/html;qs=0.9 .html
> > > >   AddType text/plain;qs=0.8 .txt
> > > >
> > > >   DirectoryIndex index.py
> > > >
> > > > > but on modpython.org they say that is not the fastest way.
> > > > >
> > > > >  Standard CGI:               23 requests/s
> > > > >     Mod_python cgihandler:     385 requests/s
> > > > >     Mod_python publisher:      476 requests/s
> > > > >     Mod_python handler:       1203 requests/s
> > > > >
> > > > > is it possible to have the publisher link mod and the handler request???
> > > >
> > > > Both mod_python.publisher and mod_python.cgihandler are merely
> > > > instances of mod_python handlers. There are slower because of the
> > > > extra work they do on top of the basic handler interface.
> > > >
> > > > I would suggest you don't worry about speed issues, most sites do
> not
> > > need
> > > > to be blindingly fast and you are probably going to have enough to
> contend
> > > > with as it is, plus find it fast enough anyway.
> > > >
> > > > FWIW, those figures were probably based on really old hardware as
> well
> > > > and can be ignored due to that fact. New hardware should perform
> much
> > > > better.
> > > >
> > > > Graham
> > > >
> > >
> > >
> > > --
> > > ---------------------------------------------------------
> > > nom : Jabon
> > > prenom : Julien
> > > matricule ulb :035890-72
> > > ---------------------------------------------------------
> > >
> > >
> > > --
> > > ---------------------------------------------------------
> > > nom : Jabon
> > > prenom : Julien
> > > matricule ulb :035890-72
> > > ---------------------------------------------------------
> > > _______________________________________________
> > > Mod_python mailing list
> > > Mod_python at modpython.org
> > > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
> 
> 
> -- 
> ---------------------------------------------------------
> nom : Jabon
> prenom : Julien
> matricule ulb :035890-72
> ---------------------------------------------------------


More information about the Mod_python mailing list