Changes between Version 1 and Version 2 of CookBookScriptsNoSuperUserSyncdb


Ignore:
Timestamp:
Jun 28, 2006, 7:46:49 PM (18 years ago)
Author:
alexis smirnov
Comment:

added an alternative approach

Legend:

Unmodified
Added
Removed
Modified
  • CookBookScriptsNoSuperUserSyncdb

    v1 v2  
    2020
    2121Now if I could only make {{{management.syncdb()}}} less verbose.
     22
     23'''alternative approach'''
     24
     25Another alternative is to change the implementation of {{{django.contrib.auth.mangement.create_superuser}}} to the following:
     26{{{
     27#!python
     28def create_superuser(app, created_models):
     29    from django.contrib.auth.models import User
     30    if User in created_models:
     31        from django.contrib.auth.create_superuser import createsuperuser
     32        import settings
     33        createsuperuser(settings.SUPERUSER, settings.SUPERUSER_EMAIL, settings.SUPERUSER_PASSWORD)
     34}}}
     35
     36Above code will create superuser based on the {{{settings}}} of your project.
Back to Top