Django Flashcards

(30 cards)

1
Q

Django’s primary design philosophy

A

DRY (Don’t Repeat Yourself)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The architectural pattern Django follows

A

MTV (Model-Template-View)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Django component representing the data structure

A

Model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Django component handling the UI/presentation layer

A

Template

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Django component containing the business logic

A

View

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Command to create a new Django project

A

django-admin startproject <name></name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Command to create a new app within a project

A

python manage.py startapp <name></name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The core configuration file for a Django project

A

settings.py

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The file used to define URL patterns

A

urls.py

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Standard library for building Web APIs in Django

A

Django REST Framework (DRF)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Command to create migration files based on model changes

A

python manage.py makemigrations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Command to apply migrations to the database

A

python manage.py migrate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Default database used by Django for local development

A

SQLite

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Recommended database for Django production environments

A

PostgreSQL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The built-in tool for managing data models via a GUI

A

Django Admin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Middleware protection against forged requests

A

CSRF (Cross-Site Request Forgery) protection

17
Q

Python object used to query the database in Django

18
Q

The method to retrieve a single object from a Model

A

Model.objects.get()

19
Q

The method to retrieve multiple objects from a Model

A

Model.objects.filter()

20
Q

Function used to convert a URL name into a path

21
Q

Template tag used for URL routing

A

{% url ‘name’ %}

22
Q

Purpose of ‘context’ in a Django view

A

A dictionary passed to the template to render data

23
Q

Standard interface for Django to communicate with web servers

A

WSGI (Web Server Gateway Interface)

24
Q

Standard interface for asynchronous Django applications

A

ASGI (Asynchronous Server Gateway Interface)

25
Package used to handle WebSockets in Django
Django Channels
26
File used to define the entry point for WSGI servers
wsgi.py
27
Command to create a user for the Admin interface
python manage.py createsuperuser
28
Django feature that prevents SQL injection
The ORM (parameterized queries)
29
The 'batteries-included' meaning
Comes with common features (Auth, Admin, ORM) built-in
30
The base class all Django models must inherit from
models.Model