Posts

Django 3 : Extending the templates

Louis SanchezMay 11th 2021, 3:06
The legacy of templates allows you to define a super template and a subtemplate that inherits from the super template. In the super template, it is possible to define blocks that subtemplates can fill. We will use an example where the page.html template will extend the base.html template. Step 1...
373

Django 3 : Passing Variables to the template

Louis SanchezMay 11th 2021, 2:54
Django 3 : Passing Variables to the template Injecting the data from the view to the template Before improving our template, we must send variables to the templates. The injection of the data is based on these variables, as the template will perform certain actions Step 1 : We will...
707

Django 3 : Displaying Hello world! in a template

Louis SanchezMay 10th 2021, 8:51
Templates are files that will allow us to generate the HTML code returned to the client. Step 1 : We will create the first template of our application. To do so, we must first edit the settings.py file to define the folder that will contain our templates. import os #...
626

Django 3 : Routing and Creating our first view

Louis SanchezMay 10th 2021, 4:20
Routing in Django Step 1 : In the previous post, we edited the settings.py file to configure our Django project. ROOT_URLCONF = 'myproject.urls' This parameter will define the Python file that will contain all the URLs of our site. When the controller receives the client request, it will go in...
327

Django 3 : Configuring the application

Louis SanchezMay 10th 2021, 6:54
To configure our project or our application, we need to edit the settings.py file in the project folder. This file contains variables. These variables are the settings that Django reads when initializing the web app. The following are a few of these variables: Step 1 : DEBUG: This parameter must...
301

Django 3 : Creating a Django Project

Louis SanchezMay 10th 2021, 6:54
Starting your project with Django Before you start using Django, you need to create an environment for your applications. We will create a Django project. This project will then contain our applications. Step 1 : To create the project of our application, we need to run the following command using...
332

Django 3 : Installing Django 3

Louis SanchezMay 10th 2021, 11:54
What is Django? Django was born in 2003 in a press agency of Lawrence, Kansas. It is a web framework that uses Python to create websites. Its goal is to write very fast dynamic websites. In 2005, the agency decided to publish the Django source code in the BSD license....
414

Python Variables

Louis SanchezMay 10th 2021, 6:51
Variables in Python can reference values of different data types such as strings, integers, floating point values, Booleans, and different data types and data structures. Python, in contrast to statically typed languages such as Java or C++, doesn't require you to pre-declare a variable's data type. It determines the type...
346

Python : Writing and Running Simple Scripts

Louis SanchezMay 11th 2021, 2:15
Python allows you to run your instructions from a saved file. A file containing Python instructions is called a module. A script is a module that can be run. By convention, Python scripts should have the file extension .py. The filename should be a valid filename, as defined by your...
324

Python : Working with the Python Interactive Shell

Louis SanchezMay 10th 2021, 12:14
We are going to be writing our first program through the Python interactive shell. Before we begin, ensure that you have Python installed on your machine. Checking our Python Installation Step 1 : Open the terminal Step 2 : Type in the command python3 and press Enter. This should open...
320