Ticket #10322: mocksoul_settings_project_module.patch

File mocksoul_settings_project_module.patch, 1.2 KB (added by MockSoul, 7 years ago)

Allow to set project module explicity in settings.

  • django/conf/global_settings.py

    === modified file 'django/conf/global_settings.py'
     
    1212DEBUG = False
    1313TEMPLATE_DEBUG = False
    1414
     15# Project module
     16PROJECT_MODULE = None
     17
    1518# Whether the framework should propagate raw exceptions rather than catching
    1619# them. This is useful under some testing siutations and should never be used
    1720# on a live site.
  • django/utils/translation/trans_real.py

    === modified file 'django/utils/translation/trans_real.py'
     
    123123
    124124    globalpath = os.path.join(os.path.dirname(sys.modules[settings.__module__].__file__), 'locale')
    125125
    126     if settings.SETTINGS_MODULE is not None:
     126    if settings.PROJECT_MODULE is not None:
     127        project = settings.PROJECT_MODULE
     128    elif settings.SETTINGS_MODULE is not None:
    127129        parts = settings.SETTINGS_MODULE.split('.')
    128130        project = __import__(parts[0], {}, {}, [])
     131    else:
     132        project = None
     133
     134    if project:
    129135        projectpath = os.path.join(os.path.dirname(project.__file__), 'locale')
    130136    else:
    131137        projectpath = None
Back to Top