Django - How to create a superuser?
Trying to get a Django app going and it comes with the admin / user system in place and I can navigate to /admin. But I can't create a super user in the terminal, as it simply has the server running.
I realised I could do this by creating a new migration file.
Link to the content I put into the migration file to create a superuser.
Great! I figured out how to do so. What I did is went to VIEWS.py. next I import the module os. Then create a function call createSuperUser(request): I then create a variable called admin and set it equal to os.system("python manage.py createsuperuser"). then after that return admin. Finally restart the django site, then it will prompt you in the terminal. Man I am so brillant. lol
Step 1: startproject
Step 2: startapp and add it to settings.py
Step 3: run these commands on console , python manage.py makemigrations and python manage.py migrate
Step 4: then run this cmd , python manage.py createsuperuser, put name(remember it will be used to login), password(remember) , email, etc.
Step 5: go to admin page <your url>/admin
Step 6: login with username and password you created