Ticket #8246: fix_subpackage_settings.patch

File fix_subpackage_settings.patch, 1022 bytes (added by Adam Gomaa, 16 years ago)

A patch to fix this issue.

  • django/core/management/__init__.py

    diff -r a65502e8c7e6 django/core/management/__init__.py
    a b  
    6666    return getattr(__import__('%s.management.commands.%s' % (app_name, name),
    6767                   {}, {}, ['Command']), 'Command')()
    6868
     69def _import(name):
     70    mod = __import__(name)
     71    components = name.split('.')
     72    for comp in components[1:]:
     73        mod = getattr(mod, comp)
     74    return mod
     75
    6976def get_commands():
    7077    """
    7178    Returns a dictionary mapping command names to their callback applications.
     
    104111        # Find the project directory
    105112        try:
    106113            from django.conf import settings
    107             project_directory = setup_environ(__import__(settings.SETTINGS_MODULE))
     114            project_directory = setup_environ(_import(settings.SETTINGS_MODULE))
    108115        except (AttributeError, EnvironmentError, ImportError):
    109116            project_directory = None
    110117
Back to Top