· 5 years ago · Nov 21, 2019, 06:06 AM
1"""
2Django settings for newspaper_project project.
3
4Generated by 'django-admin startproject' using Django 2.2.6.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.2/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.2/ref/settings/
11"""
12
13import os
14
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.2/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 'dl30$#595*)2hc6zwqg8#)&c^w+0t8_5gm2%)ga#0ab1sr8$n='
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 'users.apps.UsersConfig',
35 'pages.apps.PagesConfig',
36 'articles.apps.ArticlesConfig',
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 'whitenoise.runserver_nostatic',
45]
46
47MIDDLEWARE = [
48 'django.middleware.security.SecurityMiddleware',
49 'django.contrib.sessions.middleware.SessionMiddleware',
50 'whitenoise.middleware.WhiteNoiseMiddleware',
51 'django.middleware.common.CommonMiddleware',
52 'django.middleware.csrf.CsrfViewMiddleware',
53 'django.contrib.auth.middleware.AuthenticationMiddleware',
54 'django.contrib.messages.middleware.MessageMiddleware',
55 'django.middleware.clickjacking.XFrameOptionsMiddleware',
56]
57
58ROOT_URLCONF = 'newspaper_project.urls'
59
60TEMPLATES = [
61 {
62 'BACKEND': 'django.template.backends.django.DjangoTemplates',
63 'DIRS': [os.path.join(BASE_DIR, 'templates')],
64 'APP_DIRS': True,
65 'OPTIONS': {
66 'context_processors': [
67 'django.template.context_processors.debug',
68 'django.template.context_processors.request',
69 'django.contrib.auth.context_processors.auth',
70 'django.contrib.messages.context_processors.messages',
71 ],
72 },
73 },
74]
75
76WSGI_APPLICATION = 'newspaper_project.wsgi.application'
77
78
79# Database
80# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
81
82DATABASES = {
83 'default': {
84 'ENGINE': 'django.db.backends.mysql',
85 'NAME': 'mydb',
86 'USER': 'root',
87 'PASSWORD':'greenbutler4567',
88 'HOST': '127.0.0.1',
89 'PORT':'3306',
90 }
91}
92
93
94# Password validation
95# https://docs.djangoproject.com/en/2.2/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.2/topics/i18n/
115
116LANGUAGE_CODE = 'en-us'
117
118TIME_ZONE = 'Africa/Nairobi'
119
120USE_I18N = True
121
122USE_L10N = True
123
124USE_TZ = True
125
126
127# Static files (CSS, JavaScript, Images)
128# https://docs.djangoproject.com/en/2.2/howto/static-files/
129
130STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
131
132STATIC_URL = '/static/'
133
134STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
135
136STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
137
138AUTH_USER_MODEL = 'users.CustomUser'
139
140LOGIN_REDIRECT_URL = 'home'
141
142LOGOUT_REDIRECT_URL = 'home'
143
144CRISPY_TEMPLATE_PACK = 'bootstrap'
145
146EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
147
148EMAIL_HOST = 'smtp.sendgrid.net'
149
150EMAIL_HOST_USER = 'apikey'
151
152EMAIL_HOST_PASSWORD = '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'
153
154EMAIL_PORT = 587
155
156EMAIL_USE_TLS = True