· 7 years ago · Dec 11, 2018, 10:08 AM
1"""
2Django settings for newspaper_project project.
3
4Generated by 'django-admin startproject' using Django 2.1.2.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.1/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.1/ref/settings/
11"""
12
13import os
14import time
15# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 'k%^f&u*bpw^1kx2esm51ns%7&pd^zffmp@t46d87vq_q$idyq#'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = []
29
30
31# Application definition
32
33INSTALLED_APPS = [
34 'articles.apps.ArticlesConfig',
35 'users.apps.UsersConfig',
36 'pages.apps.PagesConfig',
37 'crispy_forms',
38 'django.contrib.admin',
39 'django.contrib.auth',
40 'django.contrib.contenttypes',
41 'django.contrib.sessions',
42 'django.contrib.messages',
43 'django.contrib.staticfiles',
44]
45
46AUTH_USER_MODEL = 'users.CustomUser'
47
48TIME_ZONE = 'America/New_York'
49
50
51MIDDLEWARE = [
52 'django.middleware.security.SecurityMiddleware',
53 'django.contrib.sessions.middleware.SessionMiddleware',
54 'django.middleware.common.CommonMiddleware',
55 'django.middleware.csrf.CsrfViewMiddleware',
56 'django.contrib.auth.middleware.AuthenticationMiddleware',
57 'django.contrib.messages.middleware.MessageMiddleware',
58 'django.middleware.clickjacking.XFrameOptionsMiddleware',
59]
60
61ROOT_URLCONF = 'newspaper_project.urls'
62
63
64TEMPLATES = [
65 {
66 'BACKEND': 'django.template.backends.django.DjangoTemplates',
67 'DIRS': [os.path.join(BASE_DIR, 'templates')],
68 'APP_DIRS': True,
69 'OPTIONS': {
70 'context_processors': [
71 'django.template.context_processors.debug',
72 'django.template.context_processors.request',
73 'django.contrib.auth.context_processors.auth',
74 'django.contrib.messages.context_processors.messages',
75 ],
76 },
77 },
78]
79
80WSGI_APPLICATION = 'newspaper_project.wsgi.application'
81
82
83# Database
84# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
85
86DATABASES = {
87 'default': {
88 'ENGINE': 'django.db.backends.sqlite3',
89 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
90 }
91}
92
93
94# Password validation
95# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
96
97AUTH_PASSWORD_VALIDATORS = [
98 {
99 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
100 },
101 {
102 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
103 },
104 {
105 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
106 },
107 {
108 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
109 },
110]
111
112
113# Internationalization
114# https://docs.djangoproject.com/en/2.1/topics/i18n/
115
116LANGUAGE_CODE = 'en-us'
117
118TIME_ZONE = 'UTC'
119
120USE_I18N = True
121
122USE_L10N = True
123
124USE_TZ = True
125
126
127STATIC_URL = '/static/'
128
129LOGIN_REDIRECT_URL = 'home'
130LOGOUT_REDIRECT_URL = 'home'
131CRISPY_TEMPLATE_PACK = 'bootstrap4'
132
133
134EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
135EMAIL_HOST = 'smtp.sendgrid.net'
136EMAIL_HOST_USER = 'apikey'
137EMAIL_HOST_PASSWORD = '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'
138EMAIL_PORT = 587
139EMAIL_USE_TLS = True