Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #1726 -- Made django/contrib/auth/ a command…

…-line function, and added docs

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f94f0555bcf98e8b05874dfa3c804393ff4b91f4 1 parent f2ef28f
@adrianholovaty adrianholovaty authored
6 django/contrib/auth/
@@ -1,5 +1,8 @@
Helper function for creating superusers in the authentication system.
+If run from the command line, this module lets you create a superuser
from django.core import validators
@@ -82,3 +85,6 @@ def createsuperuser(username=None, email=None, password=None):
u.is_superuser = True
print "Superuser created successfully."
+if __name__ == "__main__":
+ createsuperuser()
15 docs/authentication.txt
@@ -36,7 +36,7 @@ install what's needed.
The ``syncdb`` command creates the necessary database tables, creates
permission objects for all installed apps that need 'em, and prompts you to
-create a superuser account.
+create a superuser account the first time you run it.
Once you've taken those steps, that's it.
@@ -226,6 +226,19 @@ the ``django.contirb.auth.models.User`` interface, with these differences:
In practice, you probably won't need to use ``AnonymousUser`` objects on your
own, but they're used by Web requests, as explained in the next section.
+Creating superusers
+`` syncdb`` prompts you to create a superuser the first time you run
+it after adding ``'django.contrib.auth'`` to your ``INSTALLED_APPS``. But if
+you need to create a superuser after that via the command line, you can use the
+```` utility. Just run this command::
+ python /path/to/django/contrib/auth/
+Make sure to substitute ``/path/to/`` with the path to the Django codebase on
+your filesystem.
Authentication in Web requests

0 comments on commit f94f055

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