Login

Snippets by aeby

Snippet List

Custom mod_python AuthenHandler

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: <Location "/site_media/company1"> #SetHandler None ##Uncomment if you serve static files in the same virtual host PythonOption DJANGO_SETTINGS_MODULE mysite.settings PythonAuthenHandler mysite.myhandler PythonPath "['/path/to/project'] + sys.path" Require valid-user </Location>

  • apache
  • mod_python
  • auth
  • static
Read More

aeby has posted 1 snippet.