· 6 years ago · Apr 05, 2019, 09:22 AM
1
2import os
3
4# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
5BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
6
7
8# Quick-start development settings - unsuitable for production
9# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
10
11# SECURITY WARNING: keep the secret key used in production secret!
12SECRET_KEY = 'exhlfdat&vfum(-34*c2uroi(($ww(yo$9pv98=e6p^gl(-eoj'
13
14# SECURITY WARNING: don't run with debug turned on in production!
15DEBUG = True
16
17ALLOWED_HOSTS = []
18
19
20# Application definition
21
22INSTALLED_APPS = [
23 'blog.apps.BlogConfig',
24 'users.apps.UsersConfig',
25 'crispy_forms',
26 'django.contrib.admin',
27 'django.contrib.auth',
28 'django.contrib.contenttypes',
29 'django.contrib.sessions',
30 'django.contrib.messages',
31 'django.contrib.staticfiles',
32]
33
34MIDDLEWARE = [
35 'django.middleware.security.SecurityMiddleware',
36 'django.contrib.sessions.middleware.SessionMiddleware',
37 'django.middleware.common.CommonMiddleware',
38 'django.middleware.csrf.CsrfViewMiddleware',
39 'django.contrib.auth.middleware.AuthenticationMiddleware',
40 'django.contrib.messages.middleware.MessageMiddleware',
41 'django.middleware.clickjacking.XFrameOptionsMiddleware',
42]
43
44ROOT_URLCONF = 'django_project.urls'
45
46TEMPLATES = [
47 {
48 'BACKEND': 'django.template.backends.django.DjangoTemplates',
49 'DIRS': [],
50 'APP_DIRS': True,
51 'OPTIONS': {
52 'context_processors': [
53 'django.template.context_processors.debug',
54 'django.template.context_processors.request',
55 'django.contrib.auth.context_processors.auth',
56 'django.contrib.messages.context_processors.messages',
57 ],
58 },
59 },
60]
61
62WSGI_APPLICATION = 'django_project.wsgi.application'
63
64
65# Database
66# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
67
68DATABASES = {
69 'default': {
70 'ENGINE': 'django.db.backends.sqlite3',
71 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
72 }
73}
74
75
76# Password validation
77# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
78
79AUTH_PASSWORD_VALIDATORS = [
80 {
81 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
82 },
83 {
84 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
85 },
86 {
87 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
88 },
89 {
90 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
91 },
92]
93
94
95# Internationalization
96# https://docs.djangoproject.com/en/2.1/topics/i18n/
97
98LANGUAGE_CODE = 'en-us'
99
100TIME_ZONE = 'UTC'
101
102USE_I18N = True
103
104USE_L10N = True
105
106USE_TZ = True
107
108
109# Static files (CSS, JavaScript, Images)
110# https://docs.djangoproject.com/en/2.1/howto/static-files/
111
112STATIC_URL = '/static/'
113
114MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
115MEDIA_URL = '/media/'
116
117CRISPY_TEMPLATE_PACK = 'bootstrap4'
118
119LOGIN_REDIRECT_URL = 'home'
120LOGIN_URL = 'login'
121
122EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
123EMAIL_HOST = 'smtp.gmail.com'
124EMAIL_PORT = 587
125EMAIL_USE_TLS = True
126EMAIL_HOST_USER = os.environ.get('EMAIL_USER')
127EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASS')