You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

settings.py 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. import os
  2. # Django settings for oscar project.
  3. PROJECT_DIR = os.path.dirname(__file__)
  4. location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
  5. DEBUG = True
  6. TEMPLATE_DEBUG = True
  7. SQL_DEBUG = True
  8. SEND_BROKEN_LINK_EMAILS = True
  9. ADMINS = (
  10. ('David', 'david.winterbottom@tangentlabs.co.uk'),
  11. )
  12. EMAIL_SUBJECT_PREFIX = '[Oscar demo] '
  13. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  14. MANAGERS = ADMINS
  15. DATABASES = {
  16. 'default': {
  17. 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
  18. 'NAME': 'db.sqlite', # Or path to database file if using sqlite3.
  19. 'USER': '', # Not used with sqlite3.
  20. 'PASSWORD': '', # Not used with sqlite3.
  21. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
  22. 'PORT': '', # Set to empty string for default. Not used with sqlite3.
  23. }
  24. }
  25. CACHES = {
  26. 'default': {
  27. 'BACKEND':
  28. 'django.core.cache.backends.memcached.MemcachedCache',
  29. 'LOCATION': '127.0.0.1:11211',
  30. }
  31. }
  32. # Local time zone for this installation. Choices can be found here:
  33. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  34. # although not all choices may be available on all operating systems.
  35. # On Unix systems, a value of None will cause Django to use the same
  36. # timezone as the operating system.
  37. # If running in a Windows environment this must be set to the same as your
  38. # system time zone.
  39. TIME_ZONE = 'Europe/London'
  40. # Language code for this installation. All choices can be found here:
  41. # http://www.i18nguy.com/unicode/language-identifiers.html
  42. LANGUAGE_CODE = 'en-us'
  43. SITE_ID = 1
  44. # If you set this to False, Django will make some optimizations so as not
  45. # to load the internationalization machinery.
  46. USE_I18N = True
  47. # If you set this to False, Django will not format dates, numbers and
  48. # calendars according to the current locale
  49. USE_L10N = True
  50. # Absolute path to the directory that holds media.
  51. # Example: "/home/media/media.lawrence.com/"
  52. MEDIA_ROOT = location("assets/media")
  53. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  54. # trailing slash if there is a path component (optional in other cases).
  55. # Examples: "http://media.lawrence.com", "http://example.com/media/"
  56. MEDIA_URL = '/media/'
  57. # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
  58. # trailing slash.
  59. # Examples: "http://foo.com/media/", "/media/".
  60. #ADMIN_MEDIA_PREFIX = '/media/admin/'
  61. STATIC_URL = '/static/'
  62. STATICFILES_DIRS = ()
  63. STATIC_ROOT = location('public/static')
  64. # Make this unique, and don't share it with anybody.
  65. SECRET_KEY = '$)a7n&o80u!6y5t-+jrd3)3!%vh&shg$wqpjpxc!ar&p#!)n1a'
  66. # List of callables that know how to import templates from various sources.
  67. TEMPLATE_LOADERS = (
  68. 'django.template.loaders.filesystem.Loader',
  69. 'django.template.loaders.app_directories.Loader',
  70. # 'django.template.loaders.eggs.Loader',
  71. )
  72. TEMPLATE_CONTEXT_PROCESSORS = (
  73. "django.contrib.auth.context_processors.auth",
  74. "django.core.context_processors.request",
  75. "django.core.context_processors.debug",
  76. "django.core.context_processors.i18n",
  77. "django.core.context_processors.media",
  78. "django.core.context_processors.static",
  79. "django.contrib.messages.context_processors.messages",
  80. # Oscar specific
  81. 'oscar.apps.search.context_processors.search_form',
  82. 'oscar.apps.promotions.context_processors.promotions',
  83. 'oscar.apps.checkout.context_processors.checkout',
  84. 'oscar.apps.customer.notifications.context_processors.notifications',
  85. 'oscar.core.context_processors.metadata',
  86. )
  87. MIDDLEWARE_CLASSES = (
  88. 'django.middleware.common.CommonMiddleware',
  89. 'django.contrib.sessions.middleware.SessionMiddleware',
  90. 'django.middleware.csrf.CsrfViewMiddleware',
  91. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  92. 'django.contrib.messages.middleware.MessageMiddleware',
  93. 'django.middleware.transaction.TransactionMiddleware',
  94. 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
  95. 'debug_toolbar.middleware.DebugToolbarMiddleware',
  96. 'oscar.apps.basket.middleware.BasketMiddleware',
  97. )
  98. INTERNAL_IPS = ('127.0.0.1',)
  99. ROOT_URLCONF = 'urls'
  100. from oscar import OSCAR_MAIN_TEMPLATE_DIR
  101. TEMPLATE_DIRS = (
  102. location('templates'),
  103. OSCAR_MAIN_TEMPLATE_DIR,
  104. )
  105. # A sample logging configuration. The only tangible logging
  106. # performed by this configuration is to send an email to
  107. # the site admins on every HTTP 500 error.
  108. # See http://docs.djangoproject.com/en/dev/topics/logging for
  109. # more details on how to customize your logging configuration.
  110. LOGGING = {
  111. 'version': 1,
  112. 'disable_existing_loggers': False,
  113. 'formatters': {
  114. 'verbose': {
  115. 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
  116. },
  117. 'simple': {
  118. 'format': '%(levelname)s %(message)s'
  119. },
  120. },
  121. 'handlers': {
  122. 'null': {
  123. 'level':'DEBUG',
  124. 'class':'django.utils.log.NullHandler',
  125. },
  126. 'console':{
  127. 'level':'DEBUG',
  128. 'class':'logging.StreamHandler',
  129. 'formatter': 'verbose'
  130. },
  131. 'checkout_file': {
  132. 'level': 'INFO',
  133. 'class': 'oscar.core.logging.handlers.EnvFileHandler',
  134. 'filename': 'checkout.log',
  135. 'formatter': 'verbose'
  136. },
  137. 'error_file': {
  138. 'level': 'INFO',
  139. 'class': 'oscar.core.logging.handlers.EnvFileHandler',
  140. 'filename': 'errors.log',
  141. 'formatter': 'verbose'
  142. },
  143. 'mail_admins': {
  144. 'level': 'ERROR',
  145. 'class': 'django.utils.log.AdminEmailHandler',
  146. },
  147. },
  148. 'loggers': {
  149. 'django': {
  150. 'handlers':['null'],
  151. 'propagate': True,
  152. 'level':'INFO',
  153. },
  154. 'django.request': {
  155. 'handlers': ['mail_admins', 'error_file'],
  156. 'level': 'ERROR',
  157. 'propagate': False,
  158. },
  159. 'oscar.checkout': {
  160. 'handlers': ['console', 'checkout_file'],
  161. 'propagate': True,
  162. 'level':'INFO',
  163. },
  164. 'django.db.backends': {
  165. 'handlers':['null'],
  166. 'propagate': False,
  167. 'level':'DEBUG',
  168. },
  169. }
  170. }
  171. INSTALLED_APPS = [
  172. 'django.contrib.auth',
  173. 'django.contrib.contenttypes',
  174. 'django.contrib.sessions',
  175. 'django.contrib.sites',
  176. 'django.contrib.messages',
  177. 'django.contrib.admin',
  178. 'django.contrib.flatpages',
  179. 'django.contrib.staticfiles',
  180. # External apps
  181. 'django_extensions',
  182. 'haystack',
  183. 'debug_toolbar',
  184. 'south',
  185. # For profile testing
  186. 'apps.user',
  187. ]
  188. from oscar import get_core_apps
  189. INSTALLED_APPS = INSTALLED_APPS + get_core_apps()
  190. AUTHENTICATION_BACKENDS = (
  191. 'oscar.apps.customer.auth_backends.Emailbackend',
  192. 'django.contrib.auth.backends.ModelBackend',
  193. )
  194. LOGIN_REDIRECT_URL = '/accounts/'
  195. APPEND_SLASH = True
  196. # Haystack settings
  197. HAYSTACK_CONNECTIONS = {
  198. 'default': {
  199. 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
  200. },
  201. }
  202. DEBUG_TOOLBAR_CONFIG = {
  203. 'INTERCEPT_REDIRECTS': False
  204. }
  205. AUTH_PROFILE_MODULE = 'user.Profile'
  206. # Oscar settings
  207. from oscar.defaults import *
  208. OSCAR_RECENTLY_VIEWED_PRODUCTS = 20
  209. OSCAR_ALLOW_ANON_CHECKOUT = True
  210. OSCAR_SHOP_NAME = 'Oscar Demo'
  211. OSCAR_SHOP_TAGLINE = 'e-Commerce for Django'
  212. GOOGLE_ANALYTICS_ID = 'UA-XXXXX-Y'
  213. LOG_ROOT = location('logs')
  214. DISPLAY_VERSION = False
  215. THUMBNAIL_DEBUG = False
  216. # Must be within MEDIA_ROOT for sorl to work
  217. OSCAR_MISSING_IMAGE_URL = 'image_not_found.jpg'
  218. try:
  219. from settings_local import *
  220. except ImportError:
  221. pass