跳转至

配置文件

setting.py

# Django settings for myproject project.

from pathlib import Path

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-ph1tv+7nscn$338sl)wtja@cfk9tpcn2)0*)j)hgo8ij$xffz#'

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

# 允许的主机列表,用于限制允许访问的主机
ALLOWED_HOSTS = []

# 安装的应用列表
INSTALLED_APPS = []

# 中间件列表
MIDDLEWARE = []

# 根URL配置
ROOT_URLCONF = ''

# 模板配置
TEMPLATES = []

# WSGI应用程序
WSGI_APPLICATION = ''

# 数据库配置
DATABASES = {}

# 密码验证器配置
AUTH_PASSWORD_VALIDATORS = []

# 语言代码
LANGUAGE_CODE = 'zh-Hans'

# 时区
TIME_ZONE = 'UTC'

# 是否启用国际化
USE_I18N = True

# 是否启用时区支持
USE_TZ = True

# 静态文件URL
STATIC_URL = 'static/'

# 默认自动字段
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

内置应用

默认情况,INSTALLED_APPS中会自动包含下列条目,它们都是Django自动生成的:

1. django.contrib.adminadmin管理后台站点
2. django.contrib.auth身份认证系统
3. django.contrib.contenttypes内容类型框架
4. django.contrib.sessions会话框架
5. django.contrib.messages消息框架
6. django.contrib.staticfiles静态文件管理框架