New files
app/migrations/0002_auto_20241113_1653.py
# Generated by Django 5.1.3 on 2024-11-13 16:53
from django.utils import timezone
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
def create_superuser(apps, schema_editor):
from django.contrib.auth import get_user_model
User = get_user_model()
if User.objects.exists():
return
superuser = User.objects.create_superuser(
username="example_username",
email="example@example.com",
password="example_password",
last_login=timezone.now()
)
superuser.save()
operations = [
migrations.RunPython(create_superuser)
]