Django Admin Interface
Tutorial Part 2
A R U N A R U N I S T O
The life cycle of a Django app refers to the
various stages an application goes through
from its creation to its execution.
Understanding the Django app life cycle is
crucial for developers to build, deploy, and
maintain applications effectively. Here's a
general overview of the Django app life
cycle:
Project Creation
Creating a project using below command:
django-admin startproject project_folder
It will create a project named as
“project_folder”. Then change directory
using cd navigate to project folder
cd project_folder
Then use below command create an app
python manage.py startapp sample_app
The above command will create an app
named “sample_app”
After creating an application you need to get
the project to know about your app.
To do so, update INSTALLED_APPS in the
settings.py file with your app.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'sample_app',
]
Django provides a ready-to-use user
interface for administrative activities. We all
know how an admin interface is important
for a web project. Django automatically
generates admin UI based on your project
models.
Before launching your server, to access your
Admin Interface, you need to initiate the
database
python manage.py migrate
syncdb will create necessary tables or
collections depending on your db type,
necessary for the admin interface to run.
Even if you don't have a superuser, you will
be prompted to create one.
Use the below command to create a super
user (Admin):
python manage.py createsuperuser
Now to start the Admin Interface, your
admin interface is accessible at:
http://127.0.0.1:8000/admin/
If you open this it will prompt a screen like
below:
Once connected with your superuser
account, you will see the following screen:
That interface will let you administrate
Django groups and users, and all registered
models in your app. The interface gives you
the ability to do at least the "CRUD" (Create,
Read, Update, Delete) operations on your
models.