-
-
Save richardARPANET/592d96c4c99a634fdc5bc1d3c52854fa to your computer and use it in GitHub Desktop.
apps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.apps import AppConfig | |
from django.contrib.auth.models import User | |
class MyAppConfig(AppConfig): | |
name = 'my_app' | |
def ready(self): | |
if not User.objects.filter(is_superuser=True, email='admin@example.com').exists(): | |
User.objects.create_superuser( | |
username='admin', | |
email='admin@example.com', | |
password='adminpassword' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment