Django contrib admin default admin and password
DjangoDjango Problem Overview
This may be a silly question. I start a new Django project as Document says, which only included an admin page. I start the server and use a web browser accessing the page. What can I enter in the username and password? Is their any place for me to config the default admin account?
Django Solutions
Solution 1 - Django
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.
Solution 2 - Django
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.
Solution 3 - Django
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)
Solution 4 - Django
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: [email protected]
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.
Solution 5 - Django
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.