A brief description of the main configuration of the setting.py file in the Django project settings

The setting.py file covers a number of settings included in Django, but it is only part of the Django settings. Readers can visit https:docs.djangoproject.com/en/3.0/ref/settings/ to view all settings and default values.

Special attention should be paid to the following settings:

DEBUG : Defined as a Boolean value, which means to enable/disable the debugging mode of the current project. If DEBUG is True, Django will display a detailed error page when the application throws an uncaught exception. If you want to publish the project, you need to set it to False to avoid exposing some sensitive product-related parameters.
ALLOWED_HOSTS : But it will only be used when the product is released, the default is [], for beginners, you can ignore it.
INSTALLED_APPS : Represents a setting item that needs to be edited for all items. This setting item informs Django which application on the current site is active. By default, Django includes the following applications:
django.contrib.admin: management site.
  django.contrib.auth: authentication framework.
  django.contrib.contenttypes: A framework for handling content types.
django.contrib.sessions: Session framework.
django.contrib.messages: Message mechanism framework.
django.contrib.staticfiles: A framework for managing static files.
MIDDLEWARE : indicates the middleware list. When using the form later, if it is a post request, {% csrf_token %} must be added.
The ROOT_URLCONF : represents pytho module, wherein the root URL defines a path of the application.
DATABASES : Represents a dictionary that covers all database settings used by the application. The SQLite3 database is used by default.
LANGUAGE_CODE : Defines the default code language for the current Django site.
USE_TZ : Notify Django to enable/disable time zone support. Django provides date display based on time zone. When creating a new project, this setting item will be defined as True.
The above is my description of the main parameters in the setting.py file. If there are any deficiencies, please correct me.

Guess you like

Origin blog.csdn.net/Erudite_x/article/details/112298405