Author: mtredinnick
Date: 2006-08-05 21:29:38 -0500 (Sat, 05 Aug 2006)
New Revision: 3527
Modified:
django/trunk/django/core/management.py
Log:
Moved the environment setup into a method that can be called from other scripts.
Modified: django/trunk/django/core/management.py
===================================================================
--- django/trunk/django/core/management.py 2006-08-05 01:49:26 UTC (rev
3526)
+++ django/trunk/django/core/management.py 2006-08-06 02:29:38 UTC (rev
3527)
@@ -1291,7 +1291,11 @@
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 @@
# 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---