Version 1 (modified by 19 years ago) ( diff ) | ,
---|
How to run manage.py syncdb
without being prompted to create a superuser
This applies only to post-magic-removal versions of Django.
In my project I found it annoying being prompted to create a superuser everytime I ran manage.py syncdb
or from my custom installation script management.syncdb()
. Delving a little deeper I found that I could disable this by "disconnecting" django.contrib.auth.mangement.create_superuser
from the new event dispatcher in Django.
The following snippet does just that.
from django.core import management from django.dispatch import dispatcher from django.contrib.auth.management import create_superuser from django.contrib.auth import models as auth_app from django.db.models import signals dispatcher.disconnect(create_superuser, sender=auth_app, signal=signals.post_syncdb) management.syncdb()
Now if I could only make management.syncdb()
less verbose.
Note:
See TracWiki
for help on using the wiki.