· 7 years ago · Aug 18, 2018, 07:52 AM
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
15BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
16
17
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = '0&s2)q+5*cdbk#ni_d0)#5ec7dz(!@ij+0t3(nq9894xoli_h8'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = False
27
28ALLOWED_HOSTS = ['bytesnepal.herokuapp.com']
29
30
31# Application definition
32
33INSTALLED_APPS = (
34 'whitenoise.runserver_nostatic',
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 'ckeditor',
42 'Mysite'
43)
44
45MIDDLEWARE_CLASSES = (
46 'django.middleware.security.SecurityMiddleware',
47 'whitenoise.middleware.WhiteNoiseMiddleware',
48 'django.contrib.sessions.middleware.SessionMiddleware',
49 'django.middleware.common.CommonMiddleware',
50 'django.middleware.csrf.CsrfViewMiddleware',
51 'django.contrib.auth.middleware.AuthenticationMiddleware',
52 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
53 'django.contrib.messages.middleware.MessageMiddleware',
54 'django.middleware.clickjacking.XFrameOptionsMiddleware',
55 'django.middleware.security.SecurityMiddleware',
56)
57
58ROOT_URLCONF = 'Mysite.urls'
59
60TEMPLATES = [
61 {
62 'BACKEND': 'django.template.backends.django.DjangoTemplates',
63 'DIRS': [os.path.join(BASE_DIR,'Mysite/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 = 'Mysite.wsgi.application'
77
78
79# Database
80# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
81
82DATABASES = {
83 'default': {
84 'ENGINE': 'django.db.backends.sqlite3',
85 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
86 }
87}
88import dj_database_url
89db_from_env = dj_database_url.config()
90DATABASES['default'].update(db_from_env)
91DATABASES['default']['CONN_MAX_AGE'] = 500
92
93
94# Internationalization
95# https://docs.djangoproject.com/en/1.8/topics/i18n/
96
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/1.8/howto/static-files/
111
112STATIC_URL = '/static/'
113STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
114STATICFILES_DIRS = (
115 os.path.join(BASE_DIR, 'static'),
116)
117
118MEDIA_URL = '/media/'
119CKEDITOR_UPLOAD_PATH = "uploads/"
120
121STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
122CKEDITOR_CONFIGS = {
123 'default': {
124 'toolbar': None,
125 }
126}