diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-08-06 02:29:38 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-08-06 02:29:38 +0000 |
| commit | 27bf70dcb95997d8274af4d5006e3a6f9a1de040 (patch) | |
| tree | 35922d2412c87211c3efd291f46d4ddb947939ce /django | |
| parent | 0c8c42af7f5a5bb27b57d93192b77fa657d4d57f (diff) | |
Moved the environment setup into a method that can be called from other scripts.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3527 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/django/core/management.py b/django/core/management.py index 7de6c86a04..e978ae0fd0 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -1291,7 +1291,11 @@ def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING, argv=None): if action not in NO_SQL_TRANSACTION: print style.SQL_KEYWORD("COMMIT;") -def execute_manager(settings_mod, argv=None): +def setup_environ(settings_mod): + """ + Configure the runtime environment. This can also be used by external + scripts wanting to set up a similar environment to manage.py. + """ # Add this project to sys.path so that it's importable in the conventional # way. For example, if this file (manage.py) lives in a directory # "myproject", this code would add "/path/to/myproject" to sys.path. @@ -1304,6 +1308,8 @@ def execute_manager(settings_mod, argv=None): # Set DJANGO_SETTINGS_MODULE appropriately. os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % project_name +def execute_manager(settings_mod, argv=None): + setup_environ(settings_mod) action_mapping = DEFAULT_ACTION_MAPPING.copy() # Remove the "startproject" command from the action_mapping, because that's |
