Django

Django is the most popular web framework for Python.

Why Django?

Django organizes your website into apps.

It has an template engine, database support, an ORM, automatic admin interface, URL routing and way more.

You may like: Python and Django Full Stack Web Developer Bootcamp

Apps

Every app is a component of a website, these apps can be reused in other websites. An app can be anything from a poll, blog to a forum.

In the long run that will save you a lot of development time.
It’s also easy to add apps from other projects. Apps are pluggable.

Each app has its own views and models.

  • Models: store the apps data. If you want a dynamic website (using database), you need models!
  • Vies: python functions that return the webpages users see. They often use models to retrieve the data.

Inside the project directory, each app has its own directory.

Note: In the models, an object relational mapper (ORM) can be used. An ORM maps Python objects to the MySQL database, meaning you don’t have to write SQL queries.

Template engine

Django has a template language out of the box. Inside HTML, tags can be used.
If you want to print a variable:

You can loop through a list in a template:

Even if statements can be used in a template:

You may like: Python and Django Full Stack Web Developer Bootcamp

Admin Interface

Django comes with an admin interface!

It’s tedious work to create admin sites for clients to edit database data.
Django automates creation of admin interfaces for models.

django admin interface

Forms

Even forms come with Django. Automatic input validation, generate forms, convert data to python datatypes

Next Post

Leave a Reply