Getting started with Django

Amit Kumar Manjhi
Mar 5 · 3 min read
Photo by Christopher Gower on Unsplash

What is Django?

  • Django is a high-level Python Web framework that enables rapid development of secure and maintainable websites.
  • It follows Model View Controller (MVC) Design Pattern.
  • Django was invented to meet fast moving new room deadlines.
  • Started in 2003 as a internal project.
  • In 2005 released as a open source project.

What is a Web Framework?

  • A web frame work is server side application framework that design to support development of dynamic websites. Django is one of available frameworks for python.

Why Django?

  • Fast
  • Secure
  • Scalable

Django’s Design Philosophy

  • Less Code
  • Fast Development
  • Don’t Repeat Yourself (DRY)
  • Functionally Independent

Where is Django used?

  • NASA
  • YouTube
  • Pinterest
  • Mozilla
  • Instagram

What is Model View Controller?

  • MVC is design pattern used in creating web applications.
  • It consists of three components.

1. Model : Storing and maintenance of data.

2. View : Displaying the requested portion of data to the user.

3. Controller: It regulates the interaction between model and view.

MVC Design Pattern

Note: Django follows MVC pattern closely but it has its own implementation. Django offers Model,View and Templates for Development.

  • Open the terminal and type the following command for installation.
pip install Django==3.1.7 
  • OR, if you want to install along with virtual environment then use below command.
pipenv install django
  • To activate the project’s virtualenv use the below command
pipenv shell
  • To check the Django’s version
django-admin --version
  • To create project:
django-admin startproject project_name
  • To create Django App
python startapp app_name
  • To start the development server
python runserver 
  • Let’s create our Hello World app in Django

For this we need to update few files

  • let’s start by updating the

Here we need to update file with your app name that you have created.Here my app name is boardsapp.

  • let’s update the
from django.http import HttpResponse

def index(response):
return HttpResponse('Hello World')

Basically here we are saying whenever the view function is called return the text ‘Hello World’

  • Now we need to configure our urls.
from django.contrib import admin
from django.urls import path
from helloworld import views

urlpatterns = [
path('', views.index)

We have imported views from helloworld in second line and then created new url pattern for our app.

We have all the code we need now. To confirm everything works as expected, restart our Django server:

     python runserver

If you refresh the browser for it now displays the text “Hello, world!”

This Article will give you quick overview of Django.Thank you for reading. Please give it a try, have fun and share your feedback!

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store