In this tutorial I will show you how to create superuser in django project hosted in cPanel without terminal & SSH feature.
Create a file CreateSuperUser.py and paste the below code on it.
import subprocess
try:
subprocess.check_call(
'echo "from django.contrib.auth.models import User; '
'User.objects.create_superuser(\'admin\', \'admin@example.com\', \'password\')" | '
'python manage.py shell',
shell=True
)
print("Superuser created successfully")
except subprocess.CalledProcessError as e:
print(f"Error creating superuser: {e}")