[Django]-Django contrib admin default admin and password

126👍

You can config using following command line in shell

python manage.py createsuperuser

Basically you’re creating superuser who can access the django admin panel.

28👍

First you need to run migrate to change the admin username and password. Run

python manage.py migrate

Then edit the username and password using

python manage.py createsuperuser

Then give an username and password and a email.

👤KR93

7👍

If you are trying to run for the first time then first do

python manage.py migrate

this will migrate all the data into migrate folder
then simply run

python manage.py createsuperuser

3👍

you need to create a superuser to access django admin

python manage.py createsuperuser

just enter the username,email and password(password you entered is invisible to you in powershell but it saves the password)

2👍

use this command python

manage.py createsuperuser

You have 1 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): auth.
Run 'python manage.py migrate' to apply them.
Username (leave blank to use 'chatru'): admin
Email address: admin@gmail.com
Password: 
Password (again):
The password is too similar to the username.
This password is too short. It must contain at least 8 characters.
This password is too common.
Bypass password validation and create user anyway? [y/N]: y
Superuser created successfully.

-1👍

In the program settings make sure you have:

just following the BASE_DIR path definition
TEMPLATE_DIR = (Path.joinpath(BASE_DIR, "your_templates_folder"))

and

in the same file under the template configuration, must include
‘DIRS’: [TEMPLATE_DIR,],

and very importantly, run the settings.py file – I had endless struggles after making this change and not running the settings file.

Leave a comment