Django

Code

Changeset 3012

Show
Ignore:
Timestamp:
05/30/06 21:09:07 (3 years ago)
Author:
adrian
Message:

Added support to django/contrib/auth/handlers/modpython.py for setting DJANGO_SETTINGS_MODULE via a PythonOption? instead of SetEnv?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/auth/handlers/modpython.py

    r2809 r3012  
    1111    os.environ.update(req.subprocess_env) 
    1212 
    13     from django.contrib.auth.models import User 
    14  
    1513    # check for PythonOptions 
    1614    _str_to_bool = lambda s: s.lower() in ('1', 'true', 'on', 'yes') 
     
    2018    staff_only = _str_to_bool(options.get('DjangoRequireStaffStatus', "on")) 
    2119    superuser_only = _str_to_bool(options.get('DjangoRequireSuperuserStatus', "off")) 
     20    settings_module = options.get('DJANGO_SETTINGS_MODULE', None) 
     21    if settings_module: 
     22        os.environ['DJANGO_SETTINGS_MODULE'] = settings_module 
     23 
     24    from django.contrib.auth.models import User 
    2225 
    2326    # check that the username is valid 
  • django/trunk/docs/apache_auth.txt

    r1500 r3012  
    5757    ================================  ========================================= 
    5858 
     59Note that sometimes ``SetEnv`` doesn't play well in this mod_python 
     60configuration, for reasons unknown. If you're having problems getting 
     61mod_python to recognize your ``DJANGO_SETTINGS_MODULE``, you can set it using 
     62``PythonOption`` instead of ``SetEnv``. Therefore, these two Apache directives 
     63are equivalent:: 
     64 
     65    SetEnv DJANGO_SETTINGS_MODULE mysite.settings 
     66    PythonOption DJANGO_SETTINGS_MODULE mysite.settings 
     67 
    5968.. _authentication system: http://www.djangoproject.com/documentation/authentication/ 
    6069.. _Subversion: http://subversion.tigris.org/