· 5 years ago · Sep 30, 2020, 05:18 PM
1# Setting.py
2
3"""
4Django settings for src project.
5
6Generated by 'django-admin startproject' using Django 3.1.1.
7
8For more information on this file, see
9https://docs.djangoproject.com/en/3.1/topics/settings/
10
11For the full list of settings and their values, see
12https://docs.djangoproject.com/en/3.1/ref/settings/
13"""
14
15
16from pathlib import Path
17
18import environ
19
20env = environ.Env()
21environ.Env.read_env()
22
23# Build paths inside the project like this: BASE_DIR / 'subdir'.
24BASE_DIR = Path(__file__).resolve().parent.parent
25
26
27
28# Quick-start development settings - unsuitable for production
29# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
30
31# SECURITY WARNING: keep the secret key used in production secret!
32SECRET_KEY = env('SECRET_KEY')
33
34# SECURITY WARNING: don't run with debug turned on in production!
35DEBUG = env.bool('DEBUG')
36
37ALLOWED_HOSTS = ['*']
38
39
40# Application definition
41
42INSTALLED_APPS = [
43 'django.contrib.admin',
44 'django.contrib.auth',
45 'django.contrib.contenttypes',
46 'django.contrib.sessions',
47 'django.contrib.messages',
48 'django.contrib.staticfiles',
49
50
51]
52
53MIDDLEWARE = [
54 'django.middleware.security.SecurityMiddleware',
55 'django.contrib.sessions.middleware.SessionMiddleware',
56 'django.middleware.common.CommonMiddleware',
57 'django.middleware.csrf.CsrfViewMiddleware',
58 'django.contrib.auth.middleware.AuthenticationMiddleware',
59 'django.contrib.messages.middleware.MessageMiddleware',
60 'django.middleware.clickjacking.XFrameOptionsMiddleware',
61]
62
63ROOT_URLCONF = 'src.urls'
64
65TEMPLATES = [
66 {
67 'BACKEND': 'django.template.backends.django.DjangoTemplates',
68 'DIRS': [
69 BASE_DIR/'templates'
70 ],
71 'APP_DIRS': True,
72 'OPTIONS': {
73 'context_processors': [
74 'django.template.context_processors.debug',
75 'django.template.context_processors.request',
76 'django.contrib.auth.context_processors.auth',
77 'django.contrib.messages.context_processors.messages',
78 ],
79 },
80 },
81]
82
83WSGI_APPLICATION = 'src.wsgi.application'
84
85
86# Database
87# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
88
89DATABASES = {
90 'default': {
91 'ENGINE': 'django.db.backends.sqlite3',
92 'NAME': BASE_DIR / 'db.sqlite3',
93 }
94}
95
96
97# Password validation
98# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
99
100AUTH_PASSWORD_VALIDATORS = [
101 {
102 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
103 },
104 {
105 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
106 },
107 {
108 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
109 },
110 {
111 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
112 },
113]
114
115
116# Internationalization
117# https://docs.djangoproject.com/en/3.1/topics/i18n/
118
119LANGUAGE_CODE = 'en-us'
120
121TIME_ZONE = 'UTC'
122
123USE_I18N = True
124
125USE_L10N = True
126
127USE_TZ = True
128
129
130# Static files (CSS, JavaScript, Images)
131# https://docs.djangoproject.com/en/3.1/howto/static-files/
132
133STATIC_URL = '/static/'
134
135
136
137#.env file
138DEBUG =True
139SECRET_KEY =(&(=qn5mhk!1tu5l*185s%x!d$b!d91t)4gt!!m0md04$jsu_&
140
141