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_simple.py 8.1KB

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