Let’s run the
settings.py
file to get acquainted with the settings. It contains only some of Django’s settings. All of them, including their default values, can be found at https://docs.djangoproject.com/en/2.0/ref/settings/. Here are the recommended items to pay attention to first: DEBUG
is a boolean value that activates debug mode. Django will display pages detailing errors on certain exceptions. It is mandatory to set it toFalse
when you switch to a working environment. You should not deploy a site with debug mode activated, because this will make important data for the project publicly available.ALLOWED_HOSTS
does not work with debug mode activated or tests running. When the site is in working mode and theDEBUG
value isFalse
, this setting needs to be passed to the domain/host to communicate with the site.INSTALLED_APPS
is the section that you absolutely have to edit. It tells Django which applications work for a particular site. Initially Django includes the following:django.contrib.admin
: administrative sitedjango.contrib.auth
: authentication frameworkdjango.contrib.contenttypes
: a framework for handling content typesdjango.contrib.sessions
: a framework for handling sessionsdjango.contrib.messages
: message frameworkdjango.contrib.staticfiles
: a framework for managing static files.
MIDDLEWARE
– the list of firmware to be run ROOT_URLCONF
– points to the URL module where the application’s root URL patterns are defined. DATABASES
– A Python dictionary with project database settings. One default must always be present. The default configuration uses SQLite3. LANGUAGE_CODE
– responsible for configuring the default Django site language code. USE_TZ
– tells Django to enable/disable time zone support. Django has built-in support for a date and time module that works with time zones as well. It gets True
when a new project is created with the startproject
command. Don’t worry if a lot of things here seem unclear. All items will be discussed in detail in other materials.
previous post