This is our third article on Dango, in this article we are going to learn about Django Admin Site | Django Super User, you will learn how you can create Super User in Django. you can read the other articles on Django via below links.
Flask Web Development Tutorials
1: Flask CRUD Application with SQLAlchemy
2: Flask Creating News Web Application
3: Flask Creating REST API with Marshmallow
Python GUI Development Tutorials
1: PyQt5 GUI Development Tutorials
2: Pyside2 GUI Development Tutorials
3: wxPython GUI Development Tutorials
4: Kivy GUI Development Tutorials
5: TKinter GUI Development Tutorials
What is Django Admin Site ?
The Django admin is a user-friendly application to administer the contents of a relational database linked to a Django project. it is one of the most powerful parts of Django is the automatic admin interface. It reads metadata from your models to provide a quick, model-centric interface where trusted users can manage content on your site. The admin’s recommended use is limited to an organization’s internal management tool. It’s not intended for building your entire front end around. the admin has many hooks for customization, but beware of trying to use those hooks exclusively. If you need to provide a more process-centric interface that abstracts away the implementation details of database tables and fields, then it’s probably time to write your own views.
OK first of all you need to create project in Django, we have already covered the creation of the Django project in our previous article, you can use this command for creating of Django Project.
1 |
django-admin startproject MyProject |
OK now for creating of the super user, you need to change directory to the created Django
Project, in my case it is MyProject.
1 |
cd MyProject |
Now we are going to create our Super User or Admin Site by this command.
1 |
python manage.py createsuperuser |
after doing this you need to give some information for your admin panel, for example
username, email address and password.
1 2 3 4 5 |
Username (leave blank to use 'parwiz'): codeloop Email address: parwiz@codeloop.org Password: Password (again): Superuser created successfully. |
Now you can see that we have successfully created our Admin panel.
The url mapping have already done by default, after creation of the project if you
see urls.py file in your project. we have this code for django admin site.
1 2 3 4 5 6 7 8 |
from django.contrib import admin urlpatterns = [ path('admin/', admin.site.urls), ] |
So now if you run your project.
1 2 |
cd MyProject python manage.py runserver |
And go to http://localhost:8000/admin/ , after that give your username and password,
this will be the result.
Subscribe and Get Free Video Courses & Articles in your Email