Django 3 : Configuring the application

Louis SanchezNovember 26th 2020, 7:33

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 be set to True throughout the duration of development because it is the one that enables the errors to be displayed. Do not forget to set it to False when putting the project into production, because an error gives very sensitive information about the site security.

Step 2 :TIME_ZONE: This parameter sets the region referring to which it must calculate dates and times. The default is UTC.

Step 3 : DEFAULT_CHARSET: This sets the character encoding used. The default is 'utf-8'

DEFAULT_CHARSET = 'utf-8'

Step 4 : LANGUAGE_CODE: This sets the language to be used on the website. This is the main useful parameter for internationalization.

Step 5 : MIDDLEWARE: This defines the different middleware used. Middleware are classes and methods, including the methods that are performed during the request process.

Step 6 : ROOT_URLCONF : This parameter will define the Python file that will contain all the URLs of our site.

Now that we have seen the general settings of Django, we can start developing our application.