Ticket #2299: manage-settings.diff

File manage-settings.diff, 1.4 KB (added by john@…, 18 years ago)

Patch for this ticket.

  • django/conf/project_template/manage.py

     
    88    sys.exit(1)
    99
    1010if __name__ == "__main__":
    11     execute_manager(settings)
     11    import os
     12    path = os.path.normpath(os.path.join(os.getcwd(), __file__))
     13    execute_manager(settings, path)
  • django/core/management.py

     
    12281228        if action not in NO_SQL_TRANSACTION:
    12291229            print style.SQL_KEYWORD("COMMIT;")
    12301230
    1231 def execute_manager(settings_mod, argv=None):
     1231def execute_manager(settings_mod, manage_file, argv=None):
    12321232    # Add this project to sys.path so that it's importable in the conventional
    12331233    # way. For example, if this file (manage.py) lives in a directory
    12341234    # "myproject", this code would add "/path/to/myproject" to sys.path.
    1235     project_directory = os.path.dirname(settings_mod.__file__)
     1235    project_directory = os.path.dirname(manage_file)
     1236
    12361237    project_name = os.path.basename(project_directory)
    12371238    sys.path.append(os.path.join(project_directory, '..'))
    12381239    project_module = __import__(project_name, '', '', [''])
Back to Top