Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

magic-removal: Fixed #1405 -- 'createsuperuser' no longer assumes 'im…

…port pwd' will work. Thanks, anonymous

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2452 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b2dd439085fb300a4ce0d921a268d22f5b696486 1 parent e8cfcf2
@adrianholovaty adrianholovaty authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 django/core/management.py
View
11 django/core/management.py
@@ -660,10 +660,15 @@ def createsuperuser(username=None, email=None, password=None):
"Creates a superuser account."
from django.core import validators
from django.contrib.auth.models import User
- import getpass, pwd
+ import getpass
- # Determine the current system user's username, to use as a default.
- default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
+ try:
+ import pwd
+ except ImportError:
+ default_username = ''
+ else:
+ # Determine the current system user's username, to use as a default.
+ default_username = pwd.getpwuid(os.getuid())[0].replace(' ', '').lower()
# Determine whether the default username is taken, so we don't display
# it as an option.
Please sign in to comment.
Something went wrong with that request. Please try again.