Free Ebook cover System creation course with Python and Django complete

System creation course with Python and Django complete

New course

176 pages

Introduction to Django

Capítulo 56

Estimated reading time: 3 minutes

+ Exercise
Audio Icon

Listen in audio

0:00 / 0:00

Django is a high-level web development framework, written in Python, that encourages fast, clean development with pragmatic design. Through our course on building systems with Python and Django, you will be introduced to this powerful framework, allowing you to develop complex web applications with ease and efficiency.

What is Django?

Django is a free and open source web development framework written in Python. It was designed to help developers build complex, database-driven web applications. Django follows the DRY (Don't Repeat Yourself) principle, which means that it aims to reduce information duplication and increase code reuse.

Why use Django?

Django is widely used because of its ease of use, power, and flexibility. It includes many out-of-the-box features, which means developers can focus on writing their application without having to reinvent the wheel. Django is also highly customizable, allowing developers to tailor the framework to meet their specific needs.

Django Architecture

Django follows the Model-View-Controller (MVC) design pattern. However, Django calls it a Model-View-Template (MVT) because the control is handled by the framework itself.

  • Model: The Model is the single, ultimate truth about your data. It contains the essential fields and behaviors of the data you are storing. Each model corresponds to a single database table.
  • View: A View is the representation of a web page. It processes the site's request and provides a response. The View takes a Web request and returns a Web response. This response can be an HTML contents of a Web page, a redirect, a 404 error, an XML document, an image, or anything else.
  • Template: A Template is a text file that defines the structure or layout of a file (such as HTML), with placeholders for data that will be filled in when the page is generated.

Django Installation

Before we can start using Django, we need to install it. To do this, you can use pip, which is Python's package installer. Just open the terminal and type the following command: pip install django

Continue in our app.

You can listen to the audiobook with the screen off, receive a free certificate for this course, and also have access to 5,000 other free online courses.

Or continue reading below...
Download App

Download the app

Creating a Django Project

After installing Django, you can create a new Django project using the following command: django-admin startproject project_name. This will create a new directory with the name you gave the project, which contains a number of automatically generated files that make up the basic structure of a Django project.

Creating a Django Application

A Django project is made up of one or more applications. A Django application is a collection of modules that represent a web application. To create a new Django application, you can use the following command: python manage.py startapp application_name.

Conclusion

This is just an introduction to Django. Throughout this course, you will learn much more about how to use this powerful framework to create complex and efficient web applications. We're excited to start this journey with you!

Now answer the exercise about the content:

What does the DRY principle mean in Django?

You are right! Congratulations, now go to the next page

You missed! Try again.

The DRY principle stands for Don't Repeat Yourself. It is a software development ethos aimed at reducing the repetition of software patterns and increasing code reusability. Django promotes this principle by encouraging developers to avoid code duplication, which makes applications easier to maintain and extend.

Next chapter

Setting up the Django development environment

Arrow Right Icon
Download the app to earn free Certification and listen to the courses in the background, even with the screen off.