Version 1 (modified by waylan, 9 years ago) (diff)

New hack DjangoAuthIntegration, created by waylan

Authenticate Trac against Django


I've worked up the beginnings of a Trac plugin that authenticates against Django users. I've since determined that I'm not likely to use it. So, if anyone is interested in maintaining it, feel free.

The basic functionality works. I can login to my django app and then I'm instantly logged into trac (without retyping my username and password). If I log out of my django app, I'm instantly logged out of trac.

It works by getting the django session from the django cookie and extracting the user from the django database. Of course, for this to work, both the trac and django instances need to be on the same machine (to access eachother) and behind the same domain (to access the cookie). I also have the beginnings of some code to assign permissions within django for trac via django's user groups. For some undetermined reason I haven't been able to override the login/out links in the nav and there's some debug code that needs removed.

A sample_trac.ini file that only contains the relevant settings has been included.

Bugs/Feature Requests

Existing bugs and feature requests for DjangoAuthIntegration are here.

If you have any issues, create a new ticket.


Download the zipped source from [download:djangoauthintegration here].


You can check out DjangoAuthIntegration from here using Subversion, or browse the source with Trac.


Install the plugin and add the following settings to trac.ini:

djangoauth.* = enabled

django_settings_module = myproject.settings
use_django_perms = false
login_url = /login/
logout_url = /logout/
  • django_settings_module should point to the django settings file that is used for your project. The file needs to be on your pythonpath and importable.
  • use_django_perms turns on or off the ability to set permission within the django admin. If used, assign your django users to groups that start with 'trac_'. So, users assigned to the 'trac_developer' group in django, would be assigned to the group 'developer' in trac. Note: All users must be 'active' in django regardless of this setting.
  • login_url and logout_url should point to the login and logout urls of your django app. Unfortunately, they do not currently override the defaults as they should. I had intended to use django's 'next' feature to redirect back to trac after login but never got that far.

Recent Changes

14791 by rjollos on 2015-07-12 01:29:22
Updates from file previously attached to wiki page.
14790 by rjollos on 2015-07-12 01:26:01
Updates from file previously attached to wiki page.
14789 by rjollos on 2015-07-12 01:25:08
Adds code previously attached to wiki page.


Author: waylan