Fixed #3381 - manage.py shell now respects PYTHONSTARTUP/.pythonrc.py.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6231 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
17cd87a264
commit
27d027782c
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
from django.core.management.base import NoArgsCommand
|
from django.core.management.base import NoArgsCommand
|
||||||
from optparse import make_option
|
from optparse import make_option
|
||||||
|
|
||||||
|
@ -43,4 +44,16 @@ class Command(NoArgsCommand):
|
||||||
import rlcompleter
|
import rlcompleter
|
||||||
readline.set_completer(rlcompleter.Completer(imported_objects).complete)
|
readline.set_completer(rlcompleter.Completer(imported_objects).complete)
|
||||||
readline.parse_and_bind("tab:complete")
|
readline.parse_and_bind("tab:complete")
|
||||||
|
|
||||||
|
# We want to honor both $PYTHONSTARTUP and .pythonrc.py, so follow system
|
||||||
|
# conventions and get $PYTHONSTARTUP first then import user.
|
||||||
|
if not use_plain:
|
||||||
|
pythonrc = os.environ.get("PYTHONSTARTUP")
|
||||||
|
if pythonrc and os.path.isfile(pythonrc):
|
||||||
|
try:
|
||||||
|
execfile(pythonrc)
|
||||||
|
except NameError:
|
||||||
|
pass
|
||||||
|
# This will import .pythonrc.py as a side-effect
|
||||||
|
import user
|
||||||
code.interact(local=imported_objects)
|
code.interact(local=imported_objects)
|
||||||
|
|
Loading…
Reference in New Issue