Automatically create an admin user when running Django's ./manage.py syncdb

Viewed 38011

My project is in early development. I frequently delete the database and run manage.py syncdb to set up my app from scratch.

Unfortunately, this always pops up:

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): 

Then you have supply a username, valid email adress and password. This is tedious. I'm getting tired of typing test\nx@x.com\ntest\ntest\n.

How can I automatically skip this step and create a user programatically when running manage.py syncdb ?

15 Answers

Developing with sqlite. Clear database by deleting file. Load admin from fixtures.

change manage.py (django 1.4):

# hack to prevent admin promt
if  len(sys.argv) == 2 and sys.argv[1] == 'syncdb':
    sys.argv.append('--noinput')
Related