Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[py3] Ported the 'shell' management command.

The user module and the execfile function were removed in Python 3.

Thanks Linovia for the report.
  • Loading branch information...
commit 723c9a8c6db60108f584972498fa6bbd3b408444 1 parent adbdb18
@aaugustin aaugustin authored
Showing with 9 additions and 9 deletions.
  1. +9 −9 django/core/management/commands/
18 django/core/management/commands/
@@ -80,14 +80,14 @@ def handle_noargs(self, **options):
# We want to honor both $PYTHONSTARTUP and, so follow system
- # conventions and get $PYTHONSTARTUP first then import user.
+ # conventions and get $PYTHONSTARTUP first then
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 as a side-effect
- import user
+ for pythonrc in (os.environ.get("PYTHONSTARTUP"),
+ os.path.expanduser('~/')):
+ if pythonrc and os.path.isfile(pythonrc):
+ try:
+ with open(pythonrc) as handle:
+ exec(compile(, pythonrc, 'exec'))
+ except NameError:
+ pass
Please sign in to comment.
Something went wrong with that request. Please try again.