| 22 | |
| 23 | '''alternative approach''' |
| 24 | |
| 25 | Another alternative is to change the implementation of {{{django.contrib.auth.mangement.create_superuser}}} to the following: |
| 26 | {{{ |
| 27 | #!python |
| 28 | def 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 | |
| 36 | Above code will create superuser based on the {{{settings}}} of your project. |