Generally if it is a beginner, a version of the need to master configuration
The DEBUG=True
# if the DEBUG=True, above and ALLOWED_HOSTS is empty, only allowed to localhost or 127.0.0.1 on the browser to access;
If the DEBUG=False, ALLOWED_HOSTS is required, if you want to allow access to all domain name, can be set to ALLOWED_HOSTS=[' * ']
ALLOWED_HOSTS=[]
# Application definition
# tell django inside what APP, if there is a new APP to create, so need to add the name of the APP in there, for example, I created the work the APP, so below should also add the following:
INSTALLED_APPS=[
'the django. Contrib. Admin,
'the django. Contrib. Auth',
'the django. Contrib. Contenttypes',
'the django. Contrib. Sessions',
'the django. Contrib. Messages',
'the django. Contrib. Staticfiles',
'work',
]
MIDDLEWARE=[
'the django. Middleware. Security. SecurityMiddleware',
'the django. Contrib. Sessions. Middleware. SessionMiddleware',
'django.middleware.common.Com monMiddleware',
# 'django. Middleware. CSRF. CsrfViewMiddleware',//for a beginner, can cancel validation
'the django. Contrib. Auth. Middleware. AuthenticationMiddleware',
'the django. Contrib. Messages. Middleware. MessageMiddleware',
'the django. Middleware. Clickjacking. XFrameOptionsMiddleware',
]
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
# set up the database, I here for mysql
The DATABASES={
'default' : {
'ENGINE' : 'the django. Db. Backends. Mysql,
'NAME' : '17 simplify,
'USER' : 'root',
'PASSWORD', '123',
'HOST' : '127.0.0.1,
'PORT', '3306',
}
# the Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
# language configuration
LANGUAGE_CODE='en - us'
# modify the time zone in Shanghai, then UTC time for China
TIME_ZONE='Asia/Shanghai'
USE_I18N=True
USE_L10N=True
# if it is True is to international time, False is Shanghai
USE_TZ=False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
# image location was in the JavaScript
STATIC_URL='/static/'