· 8 years ago · Oct 29, 2017, 06:56 PM
1import os
2import platform
3import dj_database_url
4
5DEBUG = True
6TEMPLATE_DEBUG = DEBUG
7
8# This should work for any deployment
9BASE_DIR = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..'))
10
11ADMINS = (
12 ('me', 'me@gmailcom'),
13)
14
15MANAGERS = ADMINS
16# LOCAL SETTINGS
17if platform.system() in ['Windows', 'Darwin']:
18 #EV = 'LOCAL'
19 DATABASES = {
20 'default': {
21 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
22 'NAME': BASE_DIR + '//db//db.sqlite3',
23 'USER': '', # Not used with sqlite3.
24 'PASSWORD': '', # Not used with sqlite3.
25 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
26 'PORT': '', # Set to empty string for default. Not used with sqlite3.
27 }
28 }
29 # Hosts/domain names that are valid for this site; required if DEBUG is False
30 # See https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts
31 ALLOWED_HOSTS = []
32
33 CACHES = {
34 'default': {
35 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
36 'LOCATION': 'unique-snowflake',
37 'TIMEOUT': 86400,
38 'OPTIONS': {
39 'MAX_ENTRIES': 10000
40 },
41 }
42 }
43
44# HEROKU SETTINGS
45else:
46 #EV = 'HEROKU'
47 # DEBUG = False
48 DATABASES = {}
49 DATABASES['default'] = dj_database_url.config()
50
51 # Honor the 'X-Forwarded-Proto' header for request.is_secure()
52 SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
53
54 # Hosts/domain names that are valid for this site; required if DEBUG is False
55 # See https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts
56 # Allow all host headers
57 ALLOWED_HOSTS = ['*']
58
59 # Todo: ammar - update to Memcached
60 CACHES = {
61 'default': {
62 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
63 'LOCATION': 'unique-snowflake',
64 'TIMEOUT': 86400,
65 'OPTIONS': {'MAX_ENTRIES': 10000},
66 }
67 }
68
69TIME_ZONE = 'Europe/London'
70
71LANGUAGE_CODE = 'en-gb'
72
73SITE_ID = 1
74
75USE_I18N = True
76
77USE_L10N = True
78
79USE_TZ = False
80
81MEDIA_ROOT = ''
82
83MEDIA_URL = '/media/'
84
85STATIC_ROOT = ''
86
87STATIC_URL = '/static/'
88
89
90STATICFILES_DIRS = ()
91
92STATICFILES_FINDERS = (
93 'django.contrib.staticfiles.finders.FileSystemFinder',
94 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
95)
96
97
98SECRET_KEY = '***'
99
100TEMPLATE_LOADERS = (
101 'django.template.loaders.filesystem.Loader',
102 'django.template.loaders.app_directories.Loader',
103# 'django.template.loaders.eggs.Loader',
104
105)
106
107MIDDLEWARE_CLASSES = (
108 'django.middleware.common.CommonMiddleware',
109 'django.contrib.sessions.middleware.SessionMiddleware',
110 'django.middleware.csrf.CsrfViewMiddleware',
111 'django.contrib.auth.middleware.AuthenticationMiddleware',
112 'django.contrib.messages.middleware.MessageMiddleware',
113 # Uncomment the next line for simple clickjacking protection:
114 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
115)
116
117ROOT_URLCONF = 'sm.urls'
118
119# Python dotted path to the WSGI application used by Django's runserver.
120WSGI_APPLICATION = 'sm.wsgi.application'
121
122TEMPLATE_DIRS = (
123 os.path.join(BASE_DIR, 'mytemplates')
124)
125
126INSTALLED_APPS = (
127 'django.contrib.auth',
128 'django.contrib.contenttypes',
129 'django.contrib.sessions',
130 'django.contrib.sites',
131 'django.contrib.messages',
132 'django.contrib.staticfiles',
133 # Uncomment the next line to enable the admin:
134 'django.contrib.admin',
135 # Uncomment the next line to enable admin documentation:
136 'django.contrib.admindocs',
137 'smcore',
138 'south',
139 'django.contrib.humanize',
140)
141
142
143
144LOGGING = {
145 'version': 1,
146 'disable_existing_loggers': False,
147 'filters': {
148 'require_debug_false': {
149 '()': 'django.utils.log.RequireDebugFalse'
150 }
151 },
152 'handlers': {
153 'mail_admins': {
154 'level': 'ERROR',
155 'filters': ['require_debug_false'],
156 'class': 'django.utils.log.AdminEmailHandler'
157 }
158 },
159 'loggers': {
160 'django.request': {
161 'handlers': ['mail_admins'],
162 'level': 'ERROR',
163 'propagate': True,
164 },
165 }
166}
167
168LOGIN_URL = '/login/'
169LOGIN_REDIRECT_URL = '/getStarted/'
170LOGOUT_URL = '/do_logout/'
171
172# e-mail server
173EMAIL_HOST_USER = '***@gmail.com'
174EMAIL_HOST= 'smtp.gmail.com'
175# EMAIL_PORT = 465
176EMAIL_USE_TLS = True
177EMAIL_HOST_PASSWORD = '***'
178DEFAULT_FROM_EMAIL = '***@gmail.com'
179SERVER_EMAIL = '***@gmail.com'
180
181STATIC_ROOT = 'staticfiles'
182
183STATIC_URL = '/static/'
184
185STATICFILES_DIRS = (
186 (os.path.join(BASE_DIR,'smcore','static')),
187)
188
189
190STATICFILES_FINDERS = (
191
192 #'django.contrib.staticfiles.finders.FileSystemFinder',
193 #'django.contrib.staticfiles.finders.AppDirectoriesFinder',
194 #'django.contrib.staticfiles.finders.DefaultStorageFinder',
195)
196
197from <app> import settings
198urlpatterns += patterns('',
199 (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
200 )
201
202# Static asset configuration
203BASE_DIR = os.path.dirname(os.path.abspath(__file__))
204STATIC_ROOT = 'staticfiles'
205STATIC_URL = '/static/'
206STATICFILES_DIRS = (
207 os.path.join(BASE_DIR, '../myapp/static')
208
209BASE_DIR = os.path.dirname(os.path.dirname(__file__))
210STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
211STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
212TEMPLATE_DIRS = (
213 os.path.join(BASE_DIR, 'templates'),
214 # Add to this list all the locations containing your static files
215)
216
217import os
218os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xxxx.settings")
219
220from django.core.wsgi import get_wsgi_application
221application = get_wsgi_application()
222
223import os
224os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xxxx.settings")
225
226from django.core.wsgi import get_wsgi_application
227from whitenoise.django import DjangoWhiteNoise
228application = get_wsgi_application()
229application = DjangoWhiteNoise(application)