djangosnippets.org: Latest snippets tagged with 'mod_python'http://djangosnippets.org/tags/mod_python/2010-03-02T03:48:16.645932-06:00Log username in Apache access logs
2010-03-02T03:48:16.645932-06:00arthurhttp://djangosnippets.org/snippets/1947/<p>This is a piece of middleware that reports the logged-in user back to Apache. This should cause the logged-in user to be present in the apache access log.</p>
<p>Put it in <code>settings.MIDDLEWARE_CLASSES</code> after <code>AuthenticationMiddleware</code>.</p>
<p>This has been tested with mod_python but does <a href="http://groups.google.com/group/modwsgi/browse_thread/thread/8785a99d4ba7ee99">not work with wsgi</a>.</p>
Freely redistributableLogging solution for mod_python/FCGI
2007-09-18T14:11:29.683282-05:00mikeivanovhttp://djangosnippets.org/snippets/421/<p>The solution is based on <a href="http://www.djangosnippets.org/snippets/420/">dballanc's snippet</a>.</p>
<p>Can easily be combined with any of the <a href="http://www.djangosnippets.org/tags/debug/">SQL tracing solutions</a>.</p>
<p>You might want to run a separate logging server and redirect your logs there. Please refer to the <a href="http://docs.python.org/lib/module-logging.html">logging reference manual</a>.</p>
Freely redistributableCustom mod_python AuthenHandler
2007-08-12T06:32:25.530101-05:00aebyhttp://djangosnippets.org/snippets/364/<p>This handler is useful if you serve static/media files directly from Apache only to authenticated users. It checks if a user is not anonymous (and therefore logged in) and redirects to the login site if needed.
The following apache config activates the handler:</p>
<pre><code><Location "/site_media/company1">
#SetHandler None ##Uncomment if you …</code></pre>
Freely redistributableMiddleware to log username into apache logs with mod_python
2007-03-01T16:53:37.204643-06:00kahlesshttp://djangosnippets.org/snippets/68/<p>This very simple middleware will set the 'user' attribute of a mod_python request.. this way the username is logged into the apache log ... useful when making webalizer statistics to see the activity of users ..
</p>
<p>(http://sct.sphene.net)
</p>
Freely redistributable