Django Interview Questions

2,930 views
Skip to first unread message

Dimitri Gnidash

unread,
Nov 2, 2009, 10:36:41 AM11/2/09
to Django users
Hey guys,

For all those of you interviewing or being interviewed, I created a
quick list of sample interview questions.
While not comprehensive, it is a good start to review these before the
interview, if anything, to gain a perspective on how other people
might be using Django.


http://blog.lightsonsoftware.com/django-interview-questions-0


Dimitri Gnidash
www.lightsonsoftware.com

Skylar Saveland

unread,
Nov 2, 2009, 4:11:08 PM11/2/09
to Django users
Doesn't work on my mobile browser.

Dimitri Gnidash

unread,
Sep 5, 2012, 10:05:49 AM9/5/12
to Stephen Anto, django...@googlegroups.com
This seems to be a copy-paste of Django FAQ.

On Tue, Sep 4, 2012 at 8:10 AM, Stephen Anto <charvi...@gmail.com> wrote:
> Hi Guys,
>
> I have updated Django latest interview questions and answers. It may cover
> all technical requirements of the interview.
>
> Vist http://www.f2finterview.com/web/Django/ for latest Django interview
> questions and answers
--
Dimitri
647.773.7223

Tim Chase

unread,
Sep 5, 2012, 12:19:18 PM9/5/12
to django...@googlegroups.com, Dimitri Gnidash, Stephen Anto
On 09/05/12 09:05, Dimitri Gnidash wrote:
> This seems to be a copy-paste of Django FAQ.

It seems to be a copy/paste of a LOT of sources around the web, not
just the Django FAQ :-)

-tkc


Aaron C. de Bruyn

unread,
Sep 5, 2012, 12:57:27 PM9/5/12
to django...@googlegroups.com, dimitri...@gmail.com
I disagree with the "how to install" section.
I use Nginx and uwsgi to host Django applications.
There are other ways to deploy it too.

The section makes it seem like the only 'real' way would be Apache.

Lastly, it doesn't seem to touch on how a lot of people actually
install and deploy django projects. My workflow is pretty simple
compared to what the install section says:

apt-get install python-pip python-virtualenv virtualenvwrapper
cd code
mkvirtualenv some-django-project
pip install django
django-admin startproject somedjangoproject
cd somedjangoproject
python manage.py startapp app1

Using virtualenv should also take care of the problem listed in
"Remove any old versions of Django".

I'd hate for someone to not get the job because they give a
"non-textbook" answer. ;)

-A

Kurtis Mullins

unread,
Sep 5, 2012, 1:01:55 PM9/5/12
to django...@googlegroups.com
Yeah, I think this guide is a little crazy. If I'm getting interviewed based on questions I can't answer without looking up relevant documentation then I'd probably look bad even though the interviewer is the one lacking the required knowledge to get the job done. 

Maybe that's why I don't interview too often :) Just my 2 cents.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


Amyth Arora

unread,
Sep 5, 2012, 1:53:14 PM9/5/12
to django...@googlegroups.com
after reading this guide it seems, the interviewer who asks such questions himself is new to django or more importantly to programming. When it comes to programming or codes , most of the interviewers would ask you logic based questions instead of framework based questions as technologies like django come and go on a daily basis. if your logic is clear, you can code in any language based on any CMS' or frameworks.
--
Thanks & Regards
----------------------------

Amyth [Admin - Techstricks]
Email - aroras....@gmail.com, ad...@techstricks.com
Twitter - @a_myth_________
http://techstricks.com/

Stephen Anto

unread,
Sep 6, 2012, 7:15:53 AM9/6/12
to django...@googlegroups.com
Hi Guys,

The new modified questions and answers will be updated soon....

Thanks for posting your valuable feedback. 

Stephen Anto

unread,
Sep 12, 2012, 12:17:47 AM9/12/12
to django...@googlegroups.com
Hi Guys,

I really thanks to who are all gave comments on my previous post.

Now, Keep on watching on Django interview questions and answers. I am updating questions and answers.

let me know if any feedback.

Online Interview Questions

unread,
Apr 29, 2018, 4:25:12 PM4/29/18
to Django users
30+ Latest Django interview questions

Q1. Is Django free?

Yes, Django is free open source web framework for Python

Q2. Django is based on which design pattern.

Django closely follows the MVC (Model View Controller) design pattern, however, it does use its own logic in the implementation. Because the “C” is handled by the framework itself and most of the excitement in Django happens in models, templates, and views, Django is often referred to as an MTV framework. In the MTV development pattern:

  • M stands for “Model,” the data access layer. This layer contains anything and everything about the data: how to access it, how to validate it, which behaviors it has, and the relationships between the data.
  • T stands for “Template,” the presentation layer. This layer contains presentation-related decisions: how something should be displayed on a Web page or other type of document.
  • V stands for “View,” the business logic layer. This layer contains the logic that accesses the model and defers to the appropriate template(s). You can think of it as the bridge between models and templates.

Further reading https://djangobook.com/model-view-controller-design-pattern/

Q3. When and who create Django?

According to https://en.wikipedia.org/wiki/Django_(web_framework), Django was created in the fall of 2003, when the web programmers at the Lawrence Journal-World newspaper, Adrian Holovaty and Simon Willison, began using Python to build applications. It was released publicly under a BSD license in July 2005. The framework was named after guitarist Django Reinhardt.

Q4. List server requirement to install Django Framework.

As Django is Python Framework, in order to install Django Python is required.Django comes with an inbuilt lightweight web server that you can use for the testing purpose.If you are using Django on production Apache with mod_wsgi is required.

Q5. List the database backends supported by Django Framework?

Django officially supports four database backends, they are

  • PostgreSQL
  • MySQL
  • SQLite
  • Oracle

In addition to these, you can also use following 3rd parties

  • SAP SQL Anywhere
  • IBM DB2
  • Microsoft SQL Server
  • Firebird
  • ODBC

Q6. What is recommended way to install Django?

Installing using pip is the recommended way to install Django Framework. Below are the steps to install official release of Django with pip

  • Install pip.
  • Configure virtualenv and virtualenvwrapper
  • Once virtual environment is created and activated, enter the command pip install Django to install Django

Q7. How to install the development version of Django

Follow the below steps to Install the development version of Django Framework.

    • Check out Django’s main development branch
$ git clone https://github.com/django/django.git
    • Make sure that the Python interpreter can load Django’s code. The most convenient way to do this is to use virtualenv, virtualenvwrapper, and pip.
    • After setting up and activating the virtualenv, run the following command:
$ pip install -e django/

Source:https://docs.djangoproject.com/en/2.0/topics/install/

Q8. Where are Django migrations stored?

You can think Django Migrations as version control sytem for your database/Model.It keep track of changes done in your application Models/Table like adding a field, deleting a model, etc. Migrations in Django are stored as an on-disk format, referred to here as “migration files”. These files are actually just normal Python files with an agreed-upon object layout, written in a declarative style.

A basic migration file looks like this:

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [('migrations', '0001_initial')]

    operations = [
        migrations.DeleteModel('Tribble'),
        migrations.AddField('Author', 'rating', models.IntegerField(default=0)),
    ]

Further Reading https://docs.djangoproject.com/en/2.0/topics/migrations/

Q9. How a request is processed in Django?

In Django whenever a request is made by a user, it goes through following steps:

  • Django determines the root URLconf module to use. Ordinarily, this is the value of the ROOT_URLCONF setting, but if the incoming HttpRequest object has a urlconf attribute (set by middleware), its value will be used in place of the ROOT_URLCONF setting.
  • Django loads that Python module and looks for the variable urlpatterns. This should be a Python list of django.urls.path() and/or django.urls.re_path() instances.
  • Django runs through each URL pattern, in order, and stops at the first one that matches the requested URL.
  • Once one of the URL patterns matches, Django imports and calls the given view, which is a simple Python function (or a class-based view). The view gets passed the following arguments:
    • An instance of HttpRequest.
    • If the matched URL pattern returned no named groups, then the matches from the regular expression are provided as positional arguments.
    • The keyword arguments are made up of any named parts matched by the path expression, overridden by any arguments specified in the optional kwargs argument to django.urls.path() or django.urls.re_path().
    • If no URL pattern matches, or if an exception is raised during any point in this process, Django invokes an appropriate error-handling view.

Q10 When to use the iterator in Django ORM?

Iterators are used for traversing an object in Python which implements iterator protocol. It consists of two methods __iter__() and next().
In Django, a good use of iterator is when you are processing results that take up a large amount of available memory (lots of small objects or fewer large objects).
For more clarification please read when to use and when to not use iterator() in the Python Django ORM
https://stackoverflow.com/questions/12681653/when-to-use-or-not-use-iterator-in-the-django-orm

Q11. When QuerySets are evaluated in Django?

In Django, a QuerySet can be evaluated in Iteration, Slicing, Pickling/Caching, repr(),len(), list() and bool().

Q12. How to check installed version of Django?

By running below command on Terminal.You can check installed version of Django Framework.

py -m django --version

Q13. How to set/unset session in Django?

Setting Session in Django

request.session['key'] = 'value'

Unset Session in Django

del request.session['key']

Q14. What is a context in Django?

In Django Context is a dictionary with variable names in the form of key and value like {varible1: 101, varible2: 102},when we pass this context to the template render method, {{ varible1 }} would be replaced with 101 and {{ varible2 }} with 102 in your template.

Q15. Explain mixins in Django.

A mixin is a special kind of multiple inheritance in Python. There are two main situations where mixins are used:

  • You want to provide a lot of optional features for a class.
  • You want to use one particular feature in a lot of different classes.

Read More from https://stackoverflow.com/questions/533631/what-is-a-mixin-and-why-are-they-useful

Q16. How to get current page URI in Django template.

You can use {{ request.path }} and {{ request.get_full_path }} to get current page URI in Django template

Q17. List some popular websites built on Django framework?

Following are the list of top 10 websites built on Django framework.

  1. Instagram
  2. Disqus
  3. Bitbucket
  4. Mozilla Firefox
  5. Pinterest
  6. NASA
  7. Onion
  8. The Washington Post
  9. Eventbrite
  10. Mahalo

Q18. How to create an Constant in Django.

To create a constant in Django. Open your settings.py file and add a variable like MY_CONST = “MY_VALUE”.
To use this constant in your views simply import setting like “Import settings in views.py” and use it as
settings.MY_CONST

Read More from https://www.onlineinterviewquestions.com/django-interview-questions/

pooja kaur

unread,
Jul 7, 2019, 12:59:55 PM7/7/19
to Django users
I have updated with fresh list  of django interview questions for freshers and experienced persons. 

Here  is the list 

Pradeep Singh

unread,
Jul 8, 2019, 5:42:59 AM7/8/19
to django...@googlegroups.com
thanks alot 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.

Joe Reitman

unread,
Jul 8, 2019, 9:11:55 AM7/8/19
to Django users

Error 522 Ray ID: 4f324c909f05d29a • 2019-07-08 13:11:05 UTC

Connection timed out

Reply all
Reply to author
Forward
0 new messages