Viva Questions

Django viva questions and answers

Django viva questions with answers on MVT, models, migrations, views, URLs, templates, forms, admin, ORM, authentication and deployment for student projects.

Ask on WhatsApp

What Django questions are asked in a project viva?

Django vivas focus on the MVT architecture, how a request flows from URL to view to template, models and migrations, the ORM, forms and validation, the admin panel, user authentication, static and media files, and security features such as CSRF protection.

Questions and answers

What is Django?

A high-level Python web framework that follows the model-view-template pattern and includes an ORM, admin panel and authentication.

Explain MVT.

Model defines data and talks to the database. View contains the logic and returns a response. Template is the HTML with placeholders for data.

How does a request flow in Django?

The URL dispatcher matches the path in urls.py and calls a view. The view uses models to fetch data and renders a template, returning an HTTP response.

What is the difference between a project and an app?

A project is the whole site with settings. An app is a module inside it that does one job; a project contains many apps.

What are migrations?

Files that record model changes. makemigrations creates them and migrate applies them to the database.

What is the Django ORM?

A layer that lets you query the database with Python objects instead of raw SQL.

What is a QuerySet?

A lazily evaluated collection of database rows returned by the ORM, for example Student.objects.filter(branch='CO').

What is settings.py?

The configuration file: installed apps, database, middleware, templates, static files, secret key.

What is manage.py?

A command-line utility to run the server, make migrations, create a superuser and so on.

How does Django prevent SQL injection?

The ORM builds parameterised queries, so user input is never concatenated into SQL.

What is CSRF and how does Django handle it?

Cross-site request forgery. Django's middleware requires a csrf_token in every POST form.

What is the admin panel?

An automatically generated interface to manage model data, enabled by registering models in admin.py.

What is the difference between function-based and class-based views?

Function-based views are simple functions. Class-based views use classes with reusable behaviour such as ListView and CreateView.

How do you handle forms?

With forms.Form or ModelForm, which validate input and render fields.

How is user authentication done?

With django.contrib.auth: the User model, login, logout, authenticate and the login_required decorator.

What are static and media files?

Static files are CSS, JS and images shipped with the app. Media files are uploaded by users.

What is middleware?

Hooks that process every request and response, such as security, sessions and authentication.

What is a context in templates?

A dictionary of data passed from the view to the template.

Which database did you use?

SQLite is the default for development. Mention MySQL or PostgreSQL if you configured it and why.

How would you deploy the project?

On a host such as PythonAnywhere, Render or a VPS with Gunicorn and Nginx, with DEBUG set to False and static files collected.

FAQs

Do I need to know raw SQL for a Django viva?

Know basic SELECT, INSERT and JOIN. Examiners often ask you to write the SQL equivalent of one ORM query.

Last reviewed: 2026-10-11. Always follow the format your own department gives you.

Need a hand with this?

Send your topic, deadline and your college's format. We will tell you what is pending and what to do first.