Django Interview questions

Django Interview questions and answers

What is Django?

It is a free, open source and high-level framework in Python for development of web applications.

What is advantage of using Django?

Django is very high-level framework which supports many kind of features.

  1. It supports Object Relational Mapping (ORM).
  2. It Supports Multi-language.
  3. It supports AJAX, RSS like other web frameworks.
  4. It supports testing framework.
  5. It supports MVC architecture.

What is the usage of middlewares in Django?

Middlewares in Django provides very important role in Application development.

  1.  It will help full for Session management.
  2.  Cross-site request forgery protection(CSRF) can perform by using these.
  3. Use authentication can be done.
  4. Content Gzipping can be also done.

What is the difference between syncdb and migrate command in python?


  • In this process tables are created first time and newly added apps.
  • Model won’t alter on syncdb process.


  • Migration is a process to reconstruct database schema according to altered model fields
  • Model will alter on migration process.

What is the difference between MVC & MTV?


Its Stands for Model View Controller.
Model -will represent database, means it will manage all business login by database.
View – It will represent the out put in web page or in Apps.
Controller- It will coordinate between Model and View.

Its Stands for Model Template View.
Model – Model will represent database, Manipulate all logic by backend with database.
Template – It will facility to present data.
View – It helps interface between the Model and Template.

Why Sessions in django?

  • Like Other language django also have session framework. In general session helps to stores data on the server and fetch data by Session ID which stored in browser temp memory in cookies.
  • It used for authorised the page.
  • sessions stores in database  by using the model

How to create an Constant in Django.

In Django program to create a constant and access the constant,you have to follow below three step.

  1. Open your file
  2. Add a variable like YOUR_CONST = “YOUR_VALUE”.
  3. If you want to use throughout all pages then you need to Import in setting page in like setting.YOUR_CONST

What is ALLOWED_HOSTS in Django?

ALLOWED_HOSTS is list of domain or Host, In Django there is a security measures to prevent HTTP header attacks.
This can prevented by many seemingly-safe web server configurations.

How to get which version of Django has  installed?

By running simple command, you can get the version.
py -m django –version

How to change default timezone in django ?

TIME_ZONE = ‘Asia/Kolkata’

Why to use template inheritance ?

In Django template inheritance or extends is a key features.
when user want to write or show same information or layout in every page instead of writing every time if you make a template and extend it then it will easy and more efficient way make the same.
{% extends ‘home /my_template.html’ %}
Here this piece of with extend keywords can help to inherit your “my_template.html” in other pages.

Leave a Reply

Your email address will not be published. Required fields are marked *