Authenticate Trac against Django


This is a Trac plugin that authenticates against Django users. The basic usage scenario is as follows: login to your Django app and then you are instantly logged into Trac, without having to retype username and password. When logging out of your your Django app, you will also be logged out of Trac.

It works by getting the Django session from the Django cookie and extracting the user from the Django database. Both the Trac and Django instances need to be on the same machine (to access each other) and behind the same domain (to access the cookie) for this to work.

I also have the beginnings of some code to assign permissions within Django for Trac via Django's user groups. 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.

See also: DjangoIntegrationPlugin

Bugs/Feature Requests

Existing bugs and feature requests for DjangoAuthIntegration are here.

If you have any issues, create a new ticket.


0 / 2


1 / 1


Download the zipped source from here.


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

Installation and Configuration

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

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 Python path 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.

Configuration in Apache, AuthType Basic, etc, is not needed.

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
Maintainer: none (needsadoption)

Last modified 8 months ago Last modified on Nov 16, 2015, 4:47:18 PM