Know about default Django Project settings

 

Let’s open the settings.py file and take a look at the configuration of our project.

 

 

DEBUG is a boolean that turns on/off the debug mode of the project. If set to True , Django will display detailed error pages when an uncaught exception is thrown by your application. When you move to a production environment, remember you have to set it to False . Never deploy a site into production with DEBUG turned on because you will expose sensitive data of your project.

ALLOWED_HOSTS is not applied while debug mode is on or when running tests. Once you are going to move your site to production and set DEBUG to False , you will have to add your domain/host to this setting in order to allow it to serve the Django site.

INSTALLED_APPS is a setting you will have to edit in all projects. This setting tells Django which applications are active for this site. Django includes the following applications: in default:

  • django.contrib.admin : This is an administration site.
  • django.contrib.auth : This is an authentication framework.
  • django.contrib.contenttypes : This is a framework for
  • django.contrib.sessions : This is a session framework.
  • django.contrib.messages : This is a messaging framework.
  • django.contrib.staticfiles : This is a framework for managing content types. static files.

 

MIDDLEWARE_CLASSES  is a framework of hooks into Django’s request and response processing. (You can read more here on Django documentation page )

ROOT_URLCONF indicates the Python module where the root URL patterns.

DATABASES is a dictionary containing the settings for all the databases used in the project.

LANGUAGE_CODE Defines the default language code for this Django site.

 

 

By Amit Pratap SIngh,India

Leave a Reply