Django Admin and Create User

If you are new to the Django template, here you start with Django admin and how to create a user.


Django Admin

Django Admin is a fantastic feature within Django, serving as a user-friendly interface for managing your models, allowing you to create, read, update, and delete data effortlessly.

  1. To access the admin user interface, begin by navigating to either the full-version or starter-kit folder and then execute the following command to start the server:
  2. python manage.py runserver
  3. When the server starts at http://127.0.0.1:8000/, simply append '/admin' after it, resulting in http://127.0.0.1:8000/admin.
  4. The explanation for why this URL leads to the Django admin login page can be located in your project's config/urls.py file.
  5. from django.contrib import admin
    
    urlpatterns = [
      path("admin/", admin.site.urls),
      ...
    ]
    

Create User

In order to access the admin application, we must first create a user

  1. This is accomplished by entering the following command in the command prompt:
  2. python manage.py createsuperuser
  3. This will result in the following prompt
  4. 
    Username:
    Email address: johndoe@dummymail.com
    Password:
    Password (again):
    ## This password is too short. It must contain at least 8 characters.
    ## This password is too common.
    ## This password is entirely numeric.
    Bypass password validation and create user anyway? [y/N]:
    Superuser created successfully.
                  
  5. Now You can login to your django admin
© 2017- ThemeSelection, Hand-crafted & Made with ❤️