Django offers an interactive graphical user interface (GUI) to deal with all the administrative activities. Every web project requires a ready-to-use admin interface and that’s where Django can help you. This framework automatically generates an admin interface according to your provided project models.
Also Read: Django View Creation
How to Start an Admin Interface?
This automatically generated admin interface highly depended upon the django.countrib module. To make it work efficiently, it is important that you import a few of the modules in the INSTALLED_APPS and MIDDLEWARE_CLASSES tuples. You can locate both these tuples under myproject/settings.py file.
The module which will undergo INSTALLED_APPS will look like the following:
INSTALLED_APPS = (
And for MIDDLEWARE_CLASSES, you can go ahead with the following code:
MIDDLEWARE_CLASSES = (
After you are done with the above mentioned step, you are required to launch the server so that you can access your admin interface. The following command will help you to initiate the database:
$ python manage.py migrate
To create all the necessary tables or collections as required by your admin interface, you need to use syncdb. This command works as per your database type. In case, if you haven’t created any superuser yet, then you will be prompted to create one. To create a superuser, run the following command on the terminal.
$ python manage.py createsuperuser
Now, you have reached to the step where to start an admin interface, you need to configure a URL as per the requirement of your admin interface. Make sure that your myproject/url.py file appears like the following:
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns(”,
# url(r’^$’, ‘myproject.views.home’, name = ‘home’),
# url(r’^blog/’, include(‘blog.urls’)),
It’s time to run the server. For that purpose, you are required to run the given command:
$ python manage.py runserver
To access your admin interface, type in the following URL on your admin server: http://127.0.0.1:8000/admin/ which will appear as the following:
After getting connected with your superuser account, the next screen will look similar to the given screenshot:
This admin interface will help you to administer all the Django groups and users. You can also administer all the registered models in your application. You can perform a minimum of four types of operations over here, which are CRUD (Create, Read, Update, Delete).