Top 20 Must-Know Django & Web Dev Facts Flashcards

(20 cards)

1
Q

What pattern does Django use?

A

Django uses the MTV pattern: Model (data), Template (UI), View (logic/controller).

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

What is the purpose of manage.py?

A

manage.py is used to run the server, make migrations, and create apps.

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

How do you create a new app in Django?

A

Use the command python manage.py startapp appname.

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

What do virtual environments do?

A

Virtual environments keep project dependencies separate.

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

What does settings.py contain?

A

settings.py contains app config, DB setup, static paths, etc.

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

What is the role of urls.py?

A

urls.py maps URLs to views.

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

Where is the database structure defined in Django?

A

Models define database structure in models.py.

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

What does __str__() do in Django models?

A

__str__() shows readable object names in the admin.

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

What does get_absolute_url() return?

A

get_absolute_url() returns a URL to an object’s detail page.

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

What do makemigrations and migrate do?

A

makemigrations creates migration files, migrate applies them.

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

How do you manage models in the Django admin site?

A

Register models in admin.py to manage them in the Django admin site.

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

What does Django’s ORM allow you to do?

A

Django’s ORM lets you query the database using Python.

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

What are class-based views in Django?

A

Class-based views (ListView, DetailView) simplify code reuse.

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

What is the role of HTML, CSS, and JS?

A

HTML = structure, CSS = design, JS = interactivity.

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

What do GET and POST methods do?

A

GET retrieves data; POST submits data (e.g. forms).

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

What do sessions do in Django?

A

Sessions store user-specific data across requests.

17
Q

How do you access session data?

A

Use request.session.get(‘key’, default) to access sessions.

18
Q

How do templates handle loops and conditions?

A

Templates use {% for %} and {% if %} to loop & conditionally render.

19
Q

How are static files served in Django?

A

Static files (CSS, JS) are served using the static() helper in development.

20
Q

What does it mean that Django is ‘batteries-included’?

A

Django is ‘batteries-included’—it comes with built-in tools like ORM, admin, routing, and auth.