"""
Django settings for untitled1 project. Generated by 'django-admin startproject' using Django 3.0.3. For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/ For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
""" import os # 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/3.0/howto/deployment/checklist/ # 秘钥 使用在线上环境(生产环境)
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'p2@^-qap(csy-$i8np^ur71@^rt8p2zjq4zd1b#h$440^(@=54' # 不要在生产环境中使用debug
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True # 允许的那些主机访问
#ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["*"] # Application definition # 已经安装的app,django内置的app
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app01',
] # 中间件
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 = 'untitled1.urls' # 模板
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# 这个templates是项目的,不是app的
'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 = 'untitled1.wsgi.application' # Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
# sqlite3 轻量级的嵌入级的数据库
# 常用于安卓手机
# 数据库操作相似度和mysql有%95
# 没有用户名和密码
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': '数据库名字', # 把这个数据库手动创建
# 'USER':'root',
# 'PASSWORD':"1234",
# 'HOST':'127.0.0.1',
# 'PORT':'3306', # 改端口可以防止攻击,但是一般不会轻易改
}
} # Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators AUTH_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/3.0/topics/i18n/ # 语言
LANGUAGE_CODE = 'zh-hans'
#LANGUAGE_CODE = 'en-us' # 时间
TIME_ZONE = 'Asia/Shanghai'
#TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/'

  

Django_Setings的更多相关文章

随机推荐

  1. sql server针对字符串型数字排序(针对此字符串的长度不一致)

    对于不规则的字符串数字排序,无法按照数字大的大小排序的原因是,字符串数字在数据库中按照ASCII码排序,从字符的第一个数字对比,首先就会将为首个数字相同的排在一起,在从这些字符串里面对比第二个数字,如 ...

  2. Django生成脚本迁移文件时,报错django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

    一.本人环境:django:3.0.2, python:3.8.1,  pymysql:0.9.3 二.解决步骤: 1.django目录下找到 base.py文件: 2.在base.py文件中注释以下 ...

  3. ECMAScript基本对象——Boolean对象

    1.创建 var myBoolean=new Boolean(); 2.方法 toString()把布尔值转换为字符串,并返回结果 valueOf()返回 Boolean 对象的原始值. 3.属性 1 ...

  4. Spark学习之路 (二)Spark2.3 HA集群的分布式安装[转]

    下载Spark安装包 从官网下载 http://spark.apache.org/downloads.html 从微软的镜像站下载 http://mirrors.hust.edu.cn/apache/ ...

  5. CSS的列表样式和网页背景

    CSS的列表样式 1. 设置title和列表 HTML: <!DOCTYPE html><html lang="en"><head>    &l ...

  6. Ignatius and the Princess IV HDU - 1029 基础dp

    #include<iostream> #include<cstring> #include<cmath> #include<cstdio> #inclu ...

  7. MCPS & MIPS

    MIPS:Million Instructions Per Second MCPS:Million Cycles Per Second MIPS = Total Instructions*Sampli ...

  8. ASP.NET MVC简单流程解释(传值方式)

    在上篇笔记里我们创建了一个简单的MVC程序 在view中,@Model指的就是MyFirstMvc.Models.IndexModel,我们的提交页面是/Test/Index,当我们输入完数字并按下提 ...

  9. BZOJ3680 JSOI2004 平衡点 - 随机/近似算法

    迭代乱搞了下就过了…… #include <bits/stdc++.h> using namespace std; ],y[],w[]; double xm,ym,wt,k,lambda= ...

  10. Oracle忘记用户名和密码

    Microsoft Windows [版本 10.0.16299.192](c) 2017 Microsoft Corporation.保留所有权利. C:\WINDOWS\system32>e ...