feat: Add blog, media, and support apps, implement ride credits and image API, and remove toplist feature.

This commit is contained in:
pacnpal
2025-12-26 15:15:28 -05:00
parent cd8868a591
commit 00699d53b4
77 changed files with 7274 additions and 538 deletions

32
backend/ensure_admin.py Normal file
View File

@@ -0,0 +1,32 @@
import os
import sys
import django
sys.path.append(os.path.join(os.path.dirname(__file__)))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "thrillwiki.settings")
django.setup()
from django.contrib.auth import get_user_model
User = get_user_model()
def ensure_admin():
username = "admin"
email = "admin@example.com"
password = "adminpassword"
if not User.objects.filter(username=username).exists():
print(f"Creating superuser {username}...")
User.objects.create_superuser(username=username, email=email, password=password, role="ADMIN")
print("Superuser created.")
else:
print(f"Superuser {username} already exists.")
u = User.objects.get(username=username)
if not u.is_staff or not u.is_superuser or u.role != 'ADMIN':
u.is_staff = True
u.is_superuser = True
u.role = 'ADMIN'
u.save()
print("Updated existing user to ADMIN/Superuser.")
if __name__ == "__main__":
ensure_admin()