首页 > 其他分享 >seettings配置

seettings配置

时间:2023-07-25 11:35:54浏览次数:38  
标签:en 4.2 docs 配置 auth django contrib seettings

"""
Django settings for myproject project.

Generated by 'django-admin startproject' using Django 4.2.2.

For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
import os.path
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-9jqn6^^!blf@(25@7i#rz7(@yb0y=)2z8*1f(h9m+m)4xc&et@'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["*"]

# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'firstapp',
]

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',
'zhongjianjian.md.MyMiddleware',
]

ROOT_URLCONF = 'myproject.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 = 'myproject.wsgi.application'

# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'info',
'USER': 'root',
'PASSWORD': 'root1234',
'HOST': '127.0.0.1',
'PORT': '3306',

}
}

# Password validation
# https://docs.djangoproject.com/en/4.2/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/4.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = 'static/'

STATICFILES_DIRS = [
os.path.join(BASE_DIR,'static')
]

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

标签:en,4.2,docs,配置,auth,django,contrib,seettings
From: https://www.cnblogs.com/mayueyue/p/17579354.html

相关文章

  • urls配置
    """URLconfigurationformyprojectproject.The`urlpatterns`listroutesURLstoviews.Formoreinformationpleasesee:https://docs.djangoproject.com/en/4.2/topics/http/urls/Examples:Functionviews1.Addanimport:frommy_appimp......
  • 永嘉微电/VINKA:电容式超强抗干扰 1按键/单通道/单键触摸触控芯片VK36N1D SOT23-6,该芯
    概述.VK36N1D具有1个触摸按键,可用来检测外部触摸按键上人手的触摸动作。该芯片具有较高的集成度,仅需极少的外部组件便可实现触摸按键的检测。提供了1个1对1输出脚,可通过IO脚选择上电输出电平,有直接输出和锁存输出2个型号可选。芯片内部采用特殊的集成电路,具有高电源电压抑制比......
  • easy-ui展开行配置用法(两种)
    第一种:用expand属性<easy-custom-tablerowKey="id":expand="expand"//添加expand属性,属性值为一个对象:tableData="tableData":columns="columns":maxHeight="tableHeight":headerCellSty......
  • 微服务下使用maven做多环境配置
    分享技术,用心生活前言:很多项目在开发,提测,上线时都会提前手动改一些配置文件来适应对应环境,麻烦不说了,而且也容易出错;生产环境的配置也容易暴露。基于此,我们基于springcloudalibaba架构下通过使用maven的profile来实现多环境切换的功能。1maven的profile介绍详细可查阅官......
  • ubuntu安装OpenJDK 17,并配置环境变量
    要在Ubuntu上安装OpenJDK17并配置环境变量,请按照以下步骤进行操作:第一步:打开终端(Terminal)。第二步:使用以下命令更新系统软件包列表:sudoaptupdate第三步:安装OpenJDK17:sudoaptinstallopenjdk-17-jdk以上命令将安装OpenJDK17及其相关组件。第四步:验证JDK是否已成功......
  • 在 Arch 配置 i3-wm 终端模拟器 xterm
    在Arch配置i3-wm终端模拟器xterm关于怎么在Arch安装i3-wm可以查看上一篇文章......
  • 使用emca命令行配置EM并通过浏览器访问EM示例
    EM是OracleEnterpriseManager简称,本文涉及操作及命令:配置EM-创建删除重建:   emca-configdbcontroldb-reposrecreate|drop|create启动、关闭、查看EM状态    emctlstart|stop|statusdbconsole环境:OEL5.7,ORACLE11.2.0.4,VBOX虚拟机配置EM前检查事项:1.确定......
  • centos 7配置ORACLE动态链接库
    随便在一个目录下解压instantclient-basiclite-linuxx64.zip(一般下最新的就好啦)然后在/etc/ld.so.conf文件添加解压完文件的目录 在执行ldconfig就好了。是不是很简单.ORACLE版本低的时候插入数据也许会报这个错cx_Oracle,cursor.execute(sql)执行的时候编码错误:UnicodeEn......
  • Spring Boot :项目属性配置
        这两天通过查阅了各种资料丰富了之前学习的了SpringBoot的各种东西,浅浅写一篇随笔结合之前学习的基本配置总结下吧。一、SpringBoot的项目属性配置    在之前的学习中很多时候会用到配置的信息,这些信息在测试环境和生产环境中总会有很多不同的配置,在配置完......
  • centos 5 yum安装与配置vsFTPd FTP服务器
    24Comments文章目录[隐藏]什么是vsftpd安装vsftpd配置防火墙配置vsftpd服务器添加ftp用户出现的错误vsftpd作为FTP服务器,在Linux系统中是非常常用的。下面我们介绍如何在centos系统上安装vsftp。 什么是vsftpdvsftpd是一款在Linux发行版中最受推崇的FTP......