[mod_python] Disable .py file serving in Apache

Graham Dumpleton grahamd at dscpl.com.au
Thu Jan 6 00:46:39 EST 2005

On Jan 05 23:12, =?ISO-8859-1?Q?S=E9bastien_Arnaud?= <arnaudsj at mac.com> wrote:
> Subject: [mod_python] Disable .py file serving in Apache
> Hi,
> I am running blank tonight on this simple question: "How can I make 
> sure that apache will never serve a .py file as is?"
> I have a config like this:
> 	<Directory /my/dir/>
> 			DirectoryIndex index.htm
> 			AddHandler mod_python .html
> 			PythonHandler ZPYWmc
> 			[...]
> 			PythonDebug On
> 			PythonAutoReload On
> 	</Directory>
> Basically all the .html will be looking at my handler ZPYWmc.py to know 
> what to do. All the .htm will be served as normal static files in 
> /my/dir. How can I make sure Apache does not serve /my/dir/ZPYWmc.py 
> from a simple HTTP request and show my source code to the world?

Try something like

  <Files *.py>
  Order allow,deny
  deny from all

Graham Dumpleton (grahamd at dscpl.com.au)

More information about the Mod_python mailing list