· 7 years ago · Oct 01, 2018, 01:52 PM
1"""
2Django settings for nfc_blog project.
3
4Generated by 'django-admin startproject' using Django 2.0.2.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.0/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.0/ref/settings/
11"""
12from django.contrib.messages import constants as messages
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.0/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = '8v*!l90(h=!@4r)wgx)(zxc+h-@e*-n8l=w5jsy#+7%n09#ei*'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = []
29#ALLOWED_HOSTS = ['nfcblog.herokuapp.com']
30
31
32# Application definition
33
34INSTALLED_APPS = [
35 'django.contrib.admin',
36 'django.contrib.auth',
37 'django.contrib.contenttypes',
38 'django.contrib.sessions',
39 'django.contrib.messages',
40 'django.contrib.staticfiles',
41 'nfc',
42 'contact',
43 'ckeditor',
44 'ckeditor_uploader',
45 'import_export',
46 'crispy_forms',
47]
48
49CRISPY_TEMPLATE_PACK = 'bootstrap4'
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 = 'nfc_blog.urls'
62
63TEMPLATES = [
64 {
65 'BACKEND': 'django.template.backends.django.DjangoTemplates',
66 'DIRS': [os.path.join(BASE_DIR, 'templates')],
67 'APP_DIRS': True,
68 'OPTIONS': {
69 'context_processors': [
70 'django.template.context_processors.debug',
71 'django.template.context_processors.request',
72 'django.contrib.auth.context_processors.auth',
73 'django.contrib.messages.context_processors.messages',
74 ],
75 },
76 },
77]
78
79WSGI_APPLICATION = 'nfc_blog.wsgi.application'
80
81
82# Database
83# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
84
85DATABASES = {
86 'default': {
87 'ENGINE': 'django.db.backends.sqlite3',
88 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
89 }
90}
91
92import dj_database_url
93
94db_from_env = dj_database_url.config()
95DATABASES['default'].update(db_from_env )
96
97
98
99
100# Password validation
101# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
102
103AUTH_PASSWORD_VALIDATORS = [
104 {
105 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
106 },
107 {
108 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
109 },
110 {
111 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
112 },
113 {
114 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
115 },
116]
117
118
119# Internationalization
120# https://docs.djangoproject.com/en/2.0/topics/i18n/
121
122LANGUAGE_CODE = 'en-us'
123
124TIME_ZONE = 'UTC'
125
126USE_I18N = True
127
128USE_L10N = True
129
130USE_TZ = True
131
132
133# Static files (CSS, JavaScript, Images)
134# https://docs.djangoproject.com/en/2.0/howto/static-files/
135
136STATIC_URL = '/static/'
137STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
138#STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),'static')
139
140MEDIA_URL = '/media/'
141MEDIA_ROOT = os.path.join(BASE_DIR,'media/')
142
143
144CKEDITOR_UPLOAD_PATH = 'uploads/'
145
146STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
147
148
149
150MESSAGE_TAGS = {
151 messages.INFO: 'alert alert-info',
152 messages.SUCCESS: 'alert alert-success',
153 messages.ERROR: 'alert alert-danger',
154 messages.DEBUG: 'alert alert-info',
155}