Django Flashcards

1
Q

What does Django emphasize?

A

Emphasizes the use of individual apps, each of which has its own MTV structure

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

What is an MTV framework?

A

Model Template View - Which describes the division of labor in Django.

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

What is Model in more detail?

A

Model: builds database tables and handle all interaction with the database.

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

What is template?

A

Served in their complete form to the client. Django’s templating allows us to perform some logic and inject data into our HTML documents

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

What is view?

A

The views document is somewhat confusingly named, but can be thought of as managing traffic. It is the view’s job to get the right data for the right route delivered in the right form. Views handle the data we deliver to the user to view.

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

What is the MTV vs MVC framework

A

Django:
Model - Builds database tables and handles logic that relies on data.
Template - HTML page that gets served to the client
View - Deals with aggregating data that should be returned as part of a template.

MVC:
Model - Builds database tables and may or may not contain some logic
View - HTML page that gets served to the client
Controller - May contain some logic. Receives incoming requests and sends collected data back as part of a template.

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

What is something to always keep in mind when you are working with building a web application?

A

You are really working to do something with an http request

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

Where are all the settings for a project stored and modified?

A

In Django, this file is called settings.py and this is where you can adjust some security settings, middleware used for the project, etc.

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

What is urls.py?

A

URLS.py is the master routing file

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

List the steps to get a django going

A

1) virtualenv djangoEnv
2) source djangoEnv/bin/activate
3) pip install Django
4) go to the folder or place you want to create a project
5) django-admin startproject projectname
6) mkdir in the main folder to make an apps directory
7) cd apps to go to the apps
8) touch __init__.py, this allows python interpreter to know that this folder is present and may be accessed. Other python modules can look in this directory and access the files and therefore the code they contain.
9) the manage.py file can be called using one of serverl commands to request a specific operation.
python ../manage.py startapp first_app
10) go to the settings.py which lives inside the main directory, update the installed_apps section.

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

After an http request goes through settings, where does it go next?

A

URLs.py

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