Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[1.0.X] Fixed #5753 -- Allow createsuperuser to work in situations wh…

…ere there

might be a valid password database entry for the current user id.

Backport of r9158 from trunk.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c201d14269204a95c1f95299490430b2d8206341 1 parent 48f4388
@malcolmt malcolmt authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 django/contrib/auth/management/commands/
8 django/contrib/auth/management/commands/
@@ -57,10 +57,12 @@ def handle(self, *args, **options):
# Try to determine the current system user's username to use as a default.
import pwd
- except ImportError:
- default_username = ''
- else:
default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
+ except (ImportError, KeyError):
+ # KeyError will be raised by getpwuid() if there is no
+ # corresponding entry in the /etc/passwd file (a very restricted
+ # chroot environment, for example).
+ default_username = ''
# Determine whether the default username is taken, so we don't display
# it as an option.

0 comments on commit c201d14

Please sign in to comment.
Something went wrong with that request. Please try again.