Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add call to django.setup() to enable use with Django 1.7+. Clarify comment text. #1

Merged
merged 1 commit into from May 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 11 additions & 7 deletions tracdjangoauth/auth_django.py
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