Django Blog #4: Project Settings

by Alex
Django Blog #4: Project Settings
Let’s run the 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 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 to False 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 the DEBUG value is False, 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 site
    • django.contrib.auth: authentication framework
    • django.contrib.contenttypes: a framework for handling content types
    • django.contrib.sessions: a framework for handling sessions
    • django.contrib.messages: message framework
    • django.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.

Related Posts