A Complete Beginner's guide to django Part 1 Flashcards

1
Q

Django is a … written in Python

A

Web framework

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

A Web framework is …

A

a software that supports the development of dynamic Web sites, applications, and services.

It provides a set of tools and functionalities that solves many common problems associated with Web development, such as security features, database access, sessions, template processing, URL routing, internationalization, localization, and much more.

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

Using a Web framework, such as Django, enables us to develop …

A

secure and reliable Web applications very quickly in a standardized way, without having to reinvent the wheel.

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

The development of Django is supported by the …

A

Django Software Foundation.

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

Among the biggest Web sites using Django we have: are …

A

Instagram, Mozilla, National Geographic.

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

The basic setup for django development consists of installing …

A

Python, Virtualenv, and Django.

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

What is the name of the virtual environment we use with django?

A

Virtualenv

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

What command do you use to create the virtual environment?

A

Inside the your project folder (higher level folder):

virtualenv venv.

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

How do you activate the virtual environment Virtualenv?

A

Inside the your project folder (higher level folder):

venv\Scripts\activate

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

How do you deactivate the virtual environment Virtualenv?

A

venv\Scripts\deactivate.bat

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

What comman do you use to generate a new django project?

A

Inside the your project folder (higher level folder):

django-admin startproject projectName

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

How does the folder structure of a django project look?

A

project/
is the higher level folder and it contains the djengo project folder (project/) and the virtual environment folder (venv/)

project/project/
is the django project folder and it conains all the apps including the main app (porject/) and the manage.py file

project/project/project
is the folder that contains the django settings and stuff. It contains __init__.py, settings.py, urls.py and wsgi.py

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

manage.py:

A

inside django project folder.

a shortcut to use the django-admin command-line utility. It’s used to run management commands related to our project. We will use it to run the development server, run tests, create migrations and much more.

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

__init__.py:

A

inside apps and the project folder.

this empty file tells Python that this folder is a Python package.

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

settings.py:

A

inside the project folder:

this file contains all the project’s configuration. We will refer to this file all the time!

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

urls.py:

A

inside the project folder:

this file is responsible for mapping the routes and paths in our project. For example, if you want to show something in the URL /about/, you have to map it here first.

17
Q

wsgi.py

A

inside the project folder:

this file is a simple gateway interface used for deployment.

18
Q

Django comes with a simple web server installed. What is the command to start it?

A

Inside the your project folder (higher level folder):

python manage.py runserver

19
Q

In the Django philosophy we have two important concepts:

A

app: is a Web application that does something. An app usually is composed of a set of models (database tables), views, templates, tests.
project: is a collection of configurations and apps. One project can be composed of multiple apps, or a single app.

20
Q

Hva er kommandoen for å generere board appen?

A

django-admin startapp boards

i et forum er det katogorisert slik: board –> tråd –> post.

21
Q

Hva er funksjonen til migrations/ mappen i django apper?

A

Django store some files to keep track of the changes you create in the models.py file, so to keep the database and the models.py synchronized.

22
Q

admin.py:

A

inside the app folder.

this is a configuration file for a built-in Django app called Django Admin.

23
Q

apps.py

A

inside the app folder.

this is a configuration file of the app itself.

24
Q

models.py:

A

inside the app folder.

here is where we define the entities of our Web application. The models are translated automatically by Django into database tables.

25
Q

tests.py:

A

inside the app folder.

this file is used to write unit tests for the app.

26
Q

views.py:

A

inside the app folder.

this is the file where we handle the request/response cycle of our Web application.

27
Q

To configure a project to use an app, open the … and add the app name to the … list.

A
  1. ) settings.py file (inside the project folder)

2. ) INSTALLED_APPS

28
Q

Django already come with 6 built-in apps installed. They offer common functionalities that most Web applications need, like authentication, sessions, static files management (images, javascripts, css, etc.) and so on.
What built-in apps are included in django?

A

django. contrib.admin
django. contrib.auth
django. contrib.contenttypes
django. contrib.sessions
django. contrib.messages
django. contrib.staticfiles