import os
import django
import sys

sys.path.append(os.getcwd())
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
django.setup()

from django.contrib.auth import get_user_model
User = get_user_model()

username = "admin"
password = "admin"
email = "admin@example.com"

try:
    user = User.objects.get(username=username)
    user.set_password(password)
    user.save()
    print(f"Password for user '{username}' has been reset to '{password}'.")
except User.DoesNotExist:
    user = User.objects.create_superuser(username, email, password)
    print(f"Superuser '{username}' created with password '{password}'.")
