Django is a free, open-source web framework written in Python programming language. If you are seeking for making a career in Django, you may encounter plenty of Django interview questions and answers during the interview. Preparing for Django interview can be difficult. It can, however, be made easier with these expert-authored Django interview questions and answers.
Django follows MVC pattern (Model-View-Controller), also referred to as MTV (Model-Template-View).
Model – describes database schema
Views – Controls what user can view. It retrieves data from the table and passes it to the template which is rendered to Browser eventually.
Template – Determines how the user sees it.
Controller – controls the entire flow of models and data.
When a user requests a page, Django determines whether the request URL pattern is mentioned in URLs.py. Once the regex matches, Django calls the corresponding view. HttpRequest is passed as an argument to that view function and the implementation part is executed further.
CSRF – Cross Site Request Forgery. Csrf tokens could also be sent to a client by an attacker due to session fixation or other vulnerabilities or guessed via a brute-force attack, rendered on a malicious page that generates thousands of failed requests.