Python's Django framework completes a full forum (1.settings.py source and explanation)

Source: Internet
Author: User

Effect after completion: http://www.cnblogs.com/xuyiqing/p/8274912.html

settings.py Source

"""Django settings for Blogtest project. Generated by ' Django-admin startproject ' using Django 2.0.For more information on the this file, Seehttps://docs.djangoproject . com/en/2.0/topics/settings/for the full list of settings and their values, seehttps://docs.djangoproject.com/en/2.0/ ref/settings/"""ImportOS#Build paths inside the project like This:os.path.join (Base_dir, ...)Base_dir = Os.path.dirname (Os.path.dirname (Os.path.abspath (__file__)))#Quick-start Development settings-unsuitable for production#See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/#SECURITY warning:keep The secret key used in production secret!Secret_key ='z*29%ee^w6=7s%g&^ $czcc =7 (-RZ+TD (8o_#dsrr#c% (&FR)-T'#SECURITY Warning:don ' t run with Debug turned on production!DEBUG =trueallowed_hosts= []#application DefinitionInstalled_apps= [    'Django.contrib.admin',    'Django.contrib.auth',    'Django.contrib.contenttypes',    'django.contrib.sessions',    'django.contrib.messages',    'Django.contrib.staticfiles',    'Web',] Middleware= [    'Django.middleware.security.SecurityMiddleware',    'Django.contrib.sessions.middleware.SessionMiddleware',    'Django.middleware.common.CommonMiddleware',    'Django.middleware.csrf.CsrfViewMiddleware',    'Django.contrib.auth.middleware.AuthenticationMiddleware',    'Django.contrib.messages.middleware.MessageMiddleware',    'Django.middleware.clickjacking.XFrameOptionsMiddleware',] Root_urlconf='Blogtest.urls'TEMPLATES= [    {        'Backend':'django.template.backends.django.DjangoTemplates',        'DIRS': [Os.path.join (Base_dir,'Templates')]        ,        'App_dirs': True,'OPTIONS': {            'context_processors': [                'Django.template.context_processors.debug',                'django.template.context_processors.request',                'Django.contrib.auth.context_processors.auth',                'django.contrib.messages.context_processors.messages', ],},},]wsgi_application='BlogTest.wsgi.application'#Database#https://docs.djangoproject.com/en/2.0/ref/settings/#databasesDATABASES= {    'default': {        'ENGINE':'Django.db.backends.sqlite3',        'NAME': Os.path.join (Base_dir,'Db.sqlite3'),    }}#Password Validation#https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validatorsauth_password_validators= [    {        'NAME':'django.contrib.auth.password_validation. Userattributesimilarityvalidator',    },    {        'NAME':'django.contrib.auth.password_validation. Minimumlengthvalidator',    },    {        'NAME':'Django.contrib.auth.password_validation.CommonPasswordValidator',    },    {        'NAME':'django.contrib.auth.password_validation. Numericpasswordvalidator',    },]#Internationalization#https://docs.djangoproject.com/en/2.0/topics/i18n/Language_code='en -US'Time_zone='Asia/shanghai'use_i18n=trueuse_l10n=Trueuse_tz=True#Static files (CSS, JavaScript, Images)#https://docs.djangoproject.com/en/2.0/howto/static-files/Static_url='/static/'Staticfiles_dirs=(Os.path.join (Base_dir,'Static'),) Session_cookie_age= 60 * 60 * 24session_save_every_request= True

The static file path is set here

Reset time zone to Shanghai, Asia, cannot take default

Setting session-related information

Register app

Python's Django framework completes a full forum (1.settings.py source and explanation)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.