Top Django Interview Questions

 

This time, i had compiled some Django Interview Questions. 

This List might come handy to both Interviewer and Interviewee. 

  1. How do you create new project in Django ?
  2. How do you create new app in Django ?
  3. Explain MVT architecture of Django ?
  4. What are Middlewares ?
  5. How do you create custom Middleware ? What special methods are used to handle request/response/exception ?
  6. In what order does middlewares listed in settings.py are executed when request comes ? Top to bottom or bottom to up.
  7. In what order does middlewares listed in settings.py are executed when response goes ? Top to bottom or bottom to up.
  8. Explain Django ORM(Object-relational mapper) ?
  9. How does session framework works in Django ?
  10. What is CSRF ? How can you prevent csrf attack ?
  11. What are Django forms ?
  12. What are Django Models ?
  13. How do you migrate your tables in Django ?
  14. What are model manager and how do you write custom manager ?
  15. What are Django Templates ? How template inheritance works in Django ?
  16. What is the use of wsgi.py file ?
  17. What are signals ? How do you create custom signals in Django ?
  18. What are receiver functions in Django ?
  19. What are Django template tags ?
  20. How do you create custom template tags ?
  21. What are generic views ? How many types of generic views are there ?
  22. What’s the difference between select_related and prefetch_related in Django ORM?
  23. What is the use of context processors in Django ?
  24. What 3rd party Django apps you have used ?
  25. What are Python Virtual Environments ?

 

Advertisements

Why Django ?

I had been asked many time by my friends and colleagues that why i prefer Django over other frameworks.

According to me, The framework which is used for project development should be judged on multiple parameters.

  1. On what programming language it is based ?
  2. Is there proper documentation available ?
  3. Is there good community support ?
  4. Are you proficient in the programming language it is based upon.

I prefer Django for multiple reasons. First it is developed in python and i am good in  working with python. Second, the framework encourages rapid development and clean, pragmatic design. I had been working on Django for more then 4 years now and i can confidently say, you can create any website with Django. Note: Though one should be good in Programming.

What is Django & why should I use it?

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

So, what is Django?

Django is a Python framework, which makes many things much easier.

The Django ORM

The ORM is an incredibly powerful database tool. It handles creation of your database, as well as insert, update, delete queries and some quite advanced querying – although it’s not perfect. It supports multiple databases – MySQL, PostgreSQL, Oracle & SQLite are all supported out-of-the-box assuming you have the relevant Python libraries installed.

Forms

Forms are not the most fun thing. While Django doesn’t make them fun, it at least does a lot for you. You define some fields and how you want the basic validation to work, and Django creates the HTML adds the error messages and cleans the data so you don’t get anything unexpected. The Django forms framework can even generate and update your database from a database model you create, make your job even easier.

Admin

The Django admin is more than just a scaffold. This thing has a wide range of customisations that can be applied and with little to no work could even be deployed as the final admin area of your website – it powers this one.

Why should you use Django?

Django isn’t PHP

For those wanting a change, Django isn’t PHP. While it doesn’t have the huge following that PHP does, it does have a very helpful community.

Django is Python

Python is a really nice, elegant & powered language … and by far my favourite.

Django makes things easier

Django makes things easier for you. It’s a complete framework with a lot available – but only if you want it. It tries not to get in the way and if there are things you don’t like you just go around. The templating language being a great example of this.

That doesn’t mean to say you need to be running a few hundred visitors a second, it’s really good for a smaller site as well, but just know as you grow, Django grows with you.

Top Sites developed with Django:

635917154065999535-1437171416_Pinterest-begeek-wallpaper.jpg

Disqus

Disqus.jpg

Disqus offers the best add-on tools for site owners to power discussions, increase engagement, and earn revenue.

Bitbucket

tutorial-sandbucket-bitbucket-reposview.png

Instagram

AAEAAQAAAAAAAAWYAAAAJGY4ZjlkYTJjLWJmODUtNDI4Ny04MzdhLWIzOWEyYTA0OTU0Ng.jpg

Instagram is an online mobile photo-sharing, video-sharing, and social networking service that enables its users to take pictures and videos, and share them either publicly or privately on the app, as well as through a variety of other social networking platforms, such as Facebook, Twitter, Tumblr, and Flickr.

The Washington Post

the_washington_post.jpg

The Washington Post is an American daily newspaper. It is the most widely circulated newspaper published in Washington, D.C., and was founded on December 6, 1877,making it the area’s oldest extant newspaper.

The Onion

103315996-1234096_10151915170839497_336854978_n.530x298.jpg

 

The Onion is an American digital media company and news satire organization that publishes articles on international, national, and local news.

All this websites have huge traffic and to handle this much load a framework has to be scalable, and Django does an excellent job here.