· 7 years ago · Aug 18, 2018, 12:04 PM
1"""
2Django settings for Mysite project.
3
4Generated by 'django-admin startproject' using Django 1.8.7.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.8/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.8/ref/settings/
11"""
12
13# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
14import os
15
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
17
18
19
20# Quick-start development settings - unsuitable for production
21# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
22
23# SECURITY WARNING: keep the secret key used in production secret!
24#SECRET_KEY = '0&s2)q+5*cdbk#ni_d0)#5ec7dz(!@ij+0t3(nq9894xoli_h8'
25SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '0&s2)q+5*cdbk#ni_d0)#5ec7dz(!@ij+0t3(nq9894xoli_h8')
26
27# SECURITY WARNING: don't run with debug turned on in production!
28#DEBUG = False
29DEBUG = bool(os.environ.get('DJANGO_DEBUG', False))
30ALLOWED_HOSTS = ['bytesnepal.herokuapp.com']
31
32
33# Application definition
34
35INSTALLED_APPS = (
36 'whitenoise.runserver_nostatic',
37 'django.contrib.admin',
38 'django.contrib.auth',
39 'django.contrib.contenttypes',
40 'django.contrib.sessions',
41 'django.contrib.messages',
42 'django.contrib.staticfiles',
43 'ckeditor',
44 'Mysite'
45)
46
47MIDDLEWARE_CLASSES = (
48 'django.middleware.security.SecurityMiddleware',
49 'whitenoise.middleware.WhiteNoiseMiddleware',
50 'django.contrib.sessions.middleware.SessionMiddleware',
51 'django.middleware.common.CommonMiddleware',
52 'django.middleware.csrf.CsrfViewMiddleware',
53 'django.contrib.auth.middleware.AuthenticationMiddleware',
54 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
55 'django.contrib.messages.middleware.MessageMiddleware',
56 'django.middleware.clickjacking.XFrameOptionsMiddleware',
57 'django.middleware.security.SecurityMiddleware',
58)
59
60ROOT_URLCONF = 'Mysite.urls'
61
62TEMPLATES = [
63 {
64 'BACKEND': 'django.template.backends.django.DjangoTemplates',
65 'DIRS': [os.path.join(BASE_DIR,'Mysite/templates')],
66 'APP_DIRS': True,
67 'OPTIONS': {
68 'context_processors': [
69 'django.template.context_processors.debug',
70 'django.template.context_processors.request',
71 'django.contrib.auth.context_processors.auth',
72 'django.contrib.messages.context_processors.messages',
73 ],
74 },
75 },
76]
77
78WSGI_APPLICATION = 'Mysite.wsgi.application'
79
80
81# Database
82# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
83
84DATABASES = {
85 'default': {
86 'ENGINE': 'django.db.backends.sqlite3',
87 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
88 }
89}
90import dj_database_url
91db_from_env = dj_database_url.config()
92DATABASES['default'].update(db_from_env)
93DATABASES['default']['CONN_MAX_AGE'] = 500
94
95
96# Internationalization
97# https://docs.djangoproject.com/en/1.8/topics/i18n/
98
99
100LANGUAGE_CODE = 'en-us'
101
102TIME_ZONE = 'UTC'
103
104USE_I18N = True
105
106USE_L10N = True
107
108USE_TZ = True
109
110
111# Static files (CSS, JavaScript, Images)
112# https://docs.djangoproject.com/en/1.8/howto/static-files/
113
114STATIC_ROOT = os.path.join(BASE_DIR, 'static')
115STATICFILES_DIRS = (
116 os.path.join(os.path.normpath(BASE_DIR)),
117)
118STATIC_URL = '/static/'
119
120MEDIA_URL = '/media/'
121CKEDITOR_UPLOAD_PATH = "uploads/"
122
123STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
124CKEDITOR_CONFIGS = {
125 'default': {
126 'toolbar': None,
127 'width': '100%',
128 'indent': False,
129 }
130}