Build your first web application using Django

Reading Time: 3 minutes


In our previous blog Introduction to Django, we discussed the Django’s features and architecture. In this blog, we will create a web application in Django.

For starting a new project, go to the folder where you want your project to be and run the command:

django-admin startproject django_proj


Django’s command-line utility for administrative is automatically created in each Django project. does the same thing as django-admin but takes care of a few things for you:

  1. It puts your project’s package on sys.path.

  2. It sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project’s file. In our case, in file you can see the following:

os.environ.setdefault(‘DJANGO_SETTINGS_MODULE’, ‘django_proj.settings’)


  1. Run django-admin help to display usage information and a list of the commands provided by each application.

  2. Run django-admin version to display the current Django version.

Apart from, you can see the django_proj folder, which is the name which we used for creating a project. Inside this folder, there is a file __init.py__ which is empty it just tells python that this is a python package. used for all kinds of configurations for example database. is used for mapping URL to views. Right now, you will see :

urlpatterns = [

We will discuss it later when we run the application.’s primary deployment platform is WSGI (Web Server Gateway Interface). It is a specification that describes how a web server communicates with web applications, and how web applications can be chained together to process one request.

Django’s startproject management command sets up a simple default WSGI configuration for you.

 Run application

python3 runserver

It will start your application at

Screenshot from 2019-03-09 13-21-42

You can see the unapplied migrations warning on the terminal:

To access your Admin Interface, you need to initiate the database.

Initiate Database

python3 migrate

It will create necessary tables or collections depending on your DB type(default is SQLite), necessary for the admin interface to run.

Create Superuser

python3 createsuperuser

Then start your application again, as we saw in, where admin path is stated.

Go to

Screenshot from 2019-03-09 13-28-48

Screenshot from 2019-03-09 13-30-29

Thanks for reading!


Written by 

Jyoti Sachdeva is a software consultant with more than 6 months of experience. She likes to keep up with the trending technologies. She is familiar with languages such as C,C++,Java,Scala and is currentky working on akka,akka http and scala. Her hobbies include watching tv series and movies, reading novels and dancing.