Skip to content

Commit

Permalink
Add call to django.setup() to enable use with Django 1.7+. Clarify co…
Browse files Browse the repository at this point in the history
…mment text.
  • Loading branch information
warnes committed May 19, 2015
1 parent e1d7272 commit 46171cf
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tracdjangoauth/auth_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,24 @@
except ImportError:
_ = lambda x:x

# load settings module, for example myproject.settings
# Specify your Django project in the DJANGO_SETTINGS_MODULE
# environment varible and ensure it is in the PYTHONPATH.
#
# Refer to the instructions for
# mod_python/mod_wsgi/tracd/<your webserver>
# on how to set environment variables.
#
if os.environ.has_key('DJANGO_SETTINGS_MODULE'):
__import__(os.environ['DJANGO_SETTINGS_MODULE'])

import django
from django import db
from django.contrib.auth.models import User
from django.db.models import Q

# Loading Django modules fails if DJANGO_SETTINGS_MODULE
# environment variable is not set refer to mod_python/
# mod_wsgi/tracd/<put your webserver here> instructions
# on how to set environment variables on your system
#
# Your Django project should be in PYTHONPATH
# initialize Django 1.7+
if hasattr(django, 'setup'):
django.setup()

class DjangoPasswordStore(Component):
"""Manages user accounts stored in Django's database (User-models).
Expand Down

0 comments on commit 46171cf

Please sign in to comment.