Getting started with Django

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.
  • OR, if you want to install along with virtual environment then use below command.
  • To activate the project’s virtualenv use the below command
  • To check the Django’s version
  • To create project:
  • To create Django App
  • To start the development server
  • Let’s create our Hello World app in Django

For this we need to update few files

  • let’s start by updating the settings.py

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

  • let’s update the views.py

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

  • Now we need to configure our urls.

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:

If you refresh the browser for http://127.0.0.1:8000/ 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!

Ambitious, resourceful, and focused Software Developer with a passion for problem solving and learning new technologies.

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