Django

Code

Changeset 2841

Show
Ignore:
Timestamp:
05/04/06 22:08:29 (2 years ago)
Author:
adrian
Message:

Fixed #1726 -- Made django/contrib/auth/create_superuser.py a command-line function, and added docs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/auth/create_superuser.py

    r2809 r2841  
    11""" 
    22Helper function for creating superusers in the authentication system. 
     3 
     4If run from the command line, this module lets you create a superuser 
     5interactively. 
    36""" 
    47 
     
    8386    u.save() 
    8487    print "Superuser created successfully." 
     88 
     89if __name__ == "__main__": 
     90    createsuperuser() 
  • django/trunk/docs/authentication.txt

    r2809 r2841  
    3737The ``syncdb`` command creates the necessary database tables, creates 
    3838permission objects for all installed apps that need 'em, and prompts you to 
    39 create a superuser account
     39create a superuser account the first time you run it
    4040 
    4141Once you've taken those steps, that's it. 
     
    227227own, but they're used by Web requests, as explained in the next section. 
    228228 
     229Creating superusers 
     230------------------- 
     231 
     232``manage.py syncdb`` prompts you to create a superuser the first time you run 
     233it after adding ``'django.contrib.auth'`` to your ``INSTALLED_APPS``. But if 
     234you need to create a superuser after that via the command line, you can use the 
     235``create_superuser.py`` utility. Just run this command:: 
     236 
     237    python /path/to/django/contrib/auth/create_superuser.py 
     238 
     239Make sure to substitute ``/path/to/`` with the path to the Django codebase on 
     240your filesystem. 
     241 
    229242Authentication in Web requests 
    230243==============================