Added 'shell' option to django-admin.py and manage.py

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1900 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-01-11 01:57:22 +00:00
parent 9080d5ad74
commit b94d78772f
1 changed files with 8 additions and 1 deletions

View File

@ -814,6 +814,12 @@ def createcachetable(tablename):
db.db.commit() db.db.commit()
createcachetable.args = "[tablename]" createcachetable.args = "[tablename]"
def run_shell():
"Runs a Python interactive interpreter"
import code
code.interact()
run_shell.args = ''
# Utilities for command-line script # Utilities for command-line script
DEFAULT_ACTION_MAPPING = { DEFAULT_ACTION_MAPPING = {
@ -826,6 +832,7 @@ DEFAULT_ACTION_MAPPING = {
'install': install, 'install': install,
'installperms': installperms, 'installperms': installperms,
'runserver': runserver, 'runserver': runserver,
'shell': run_shell,
'sql': get_sql_create, 'sql': get_sql_create,
'sqlall': get_sql_all, 'sqlall': get_sql_all,
'sqlclear': get_sql_delete, 'sqlclear': get_sql_delete,
@ -906,7 +913,7 @@ def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING):
sys.exit(1) sys.exit(1)
else: else:
action_mapping[action](username, email, password) action_mapping[action](username, email, password)
elif action in ('init', 'validate'): elif action in ('init', 'shell', 'validate'):
action_mapping[action]() action_mapping[action]()
elif action == 'inspectdb': elif action == 'inspectdb':
try: try: