Advertisement
Guest User

Untitled

a guest
Oct 29th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.96 KB | None | 0 0
  1. import os
  2. import platform
  3. import dj_database_url
  4.  
  5. DEBUG = True
  6. TEMPLATE_DEBUG = DEBUG
  7.  
  8. # This should work for any deployment
  9. BASE_DIR = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..'))
  10.  
  11. ADMINS = (
  12. ('me', 'me@gmailcom'),
  13. )
  14.  
  15. MANAGERS = ADMINS
  16. # LOCAL SETTINGS
  17. if 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
  45. else:
  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.  
  69. TIME_ZONE = 'Europe/London'
  70.  
  71. LANGUAGE_CODE = 'en-gb'
  72.  
  73. SITE_ID = 1
  74.  
  75. USE_I18N = True
  76.  
  77. USE_L10N = True
  78.  
  79. USE_TZ = False
  80.  
  81. MEDIA_ROOT = ''
  82.  
  83. MEDIA_URL = '/media/'
  84.  
  85. STATIC_ROOT = ''
  86.  
  87. STATIC_URL = '/static/'
  88.  
  89.  
  90. STATICFILES_DIRS = ()
  91.  
  92. STATICFILES_FINDERS = (
  93. 'django.contrib.staticfiles.finders.FileSystemFinder',
  94. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  95. )
  96.  
  97.  
  98. SECRET_KEY = '***'
  99.  
  100. TEMPLATE_LOADERS = (
  101. 'django.template.loaders.filesystem.Loader',
  102. 'django.template.loaders.app_directories.Loader',
  103. # 'django.template.loaders.eggs.Loader',
  104.  
  105. )
  106.  
  107. MIDDLEWARE_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.  
  117. ROOT_URLCONF = 'sm.urls'
  118.  
  119. # Python dotted path to the WSGI application used by Django's runserver.
  120. WSGI_APPLICATION = 'sm.wsgi.application'
  121.  
  122. TEMPLATE_DIRS = (
  123. os.path.join(BASE_DIR, 'mytemplates')
  124. )
  125.  
  126. INSTALLED_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.  
  144. LOGGING = {
  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.  
  168. LOGIN_URL = '/login/'
  169. LOGIN_REDIRECT_URL = '/getStarted/'
  170. LOGOUT_URL = '/do_logout/'
  171.  
  172. # e-mail server
  173. EMAIL_HOST_USER = '***@gmail.com'
  174. EMAIL_HOST= 'smtp.gmail.com'
  175. # EMAIL_PORT = 465
  176. EMAIL_USE_TLS = True
  177. EMAIL_HOST_PASSWORD = '***'
  178. DEFAULT_FROM_EMAIL = '***@gmail.com'
  179. SERVER_EMAIL = '***@gmail.com'
  180.  
  181. STATIC_ROOT = 'staticfiles'
  182.  
  183. STATIC_URL = '/static/'
  184.  
  185. STATICFILES_DIRS = (
  186. (os.path.join(BASE_DIR,'smcore','static')),
  187. )
  188.  
  189.  
  190. STATICFILES_FINDERS = (
  191.  
  192. #'django.contrib.staticfiles.finders.FileSystemFinder',
  193. #'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  194. #'django.contrib.staticfiles.finders.DefaultStorageFinder',
  195. )
  196.  
  197. from <app> import settings
  198. urlpatterns += patterns('',
  199. (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
  200. )
  201.  
  202. # Static asset configuration
  203. BASE_DIR = os.path.dirname(os.path.abspath(__file__))
  204. STATIC_ROOT = 'staticfiles'
  205. STATIC_URL = '/static/'
  206. STATICFILES_DIRS = (
  207. os.path.join(BASE_DIR, '../myapp/static')
  208.  
  209. BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  210. STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
  211. STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
  212. TEMPLATE_DIRS = (
  213. os.path.join(BASE_DIR, 'templates'),
  214. # Add to this list all the locations containing your static files
  215. )
  216.  
  217. import os
  218. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xxxx.settings")
  219.  
  220. from django.core.wsgi import get_wsgi_application
  221. application = get_wsgi_application()
  222.  
  223. import os
  224. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xxxx.settings")
  225.  
  226. from django.core.wsgi import get_wsgi_application
  227. from whitenoise.django import DjangoWhiteNoise
  228. application = get_wsgi_application()
  229. application = DjangoWhiteNoise(application)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement