[mod_python] How can I turn off apparent caching of python code?

Tobiah toby at rcsreg.com
Wed Aug 25 05:35:13 EDT 2004

> Within your application you can do this:
>  req.headers_out['Pragma'] = 'no-cache'
>  req.headers_out['Cache-Control'] = 'no-cache'
>  req.headers_out['Expires'] = '-1'
> Or you can simply set the headers in httpd.conf or .htaccess:
>  <Directory /var/www/foo/site>
>   AddHandler python-program .py
>   PythonHandler mod_python.publisher
>   PythonDebug On
>   # set headers to prevent caching for anything in this directory
>   Header set Pragma "no-cache"
>   Header set Cache-Control "no-cache"
>   Header set Expires "-1"
> </Directory>

My understanding of the entire request process is limited,
but don't those directives only tell the client (browser)
not to cache content?  My goal is to get mod_python to reload
imported modules when their source file date is newer then
the last import time.


More information about the Mod_python mailing list