c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
Python

How to create superuser in django project hosted in cPanel without terminal

| | django , hosting , python

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.

CreateSuperUser.py:

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}")


Copy the file location and paste in the textbox and execute the script.
Execute python Script


Video Guide:[Create SuperUser in django project without terminal & SSH Access]