Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

settings.py 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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. 'oscar.apps.customer.notifications.context_processors.notifications',
  93. )
  94. MIDDLEWARE_CLASSES = (
  95. 'django.middleware.common.CommonMiddleware',
  96. 'django.contrib.sessions.middleware.SessionMiddleware',
  97. 'django.middleware.csrf.CsrfViewMiddleware',
  98. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  99. 'django.contrib.messages.middleware.MessageMiddleware',
  100. 'django.middleware.transaction.TransactionMiddleware',
  101. 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
  102. 'debug_toolbar.middleware.DebugToolbarMiddleware',
  103. 'oscar.apps.basket.middleware.BasketMiddleware',
  104. )
  105. INTERNAL_IPS = ('127.0.0.1',)
  106. ROOT_URLCONF = 'urls'
  107. from oscar import OSCAR_MAIN_TEMPLATE_DIR
  108. TEMPLATE_DIRS = (
  109. location('templates'),
  110. OSCAR_MAIN_TEMPLATE_DIR,
  111. )
  112. # A sample logging configuration. The only tangible logging
  113. # performed by this configuration is to send an email to
  114. # the site admins on every HTTP 500 error.
  115. # See http://docs.djangoproject.com/en/dev/topics/logging for
  116. # more details on how to customize your logging configuration.
  117. LOGGING = {
  118. 'version': 1,
  119. 'disable_existing_loggers': False,
  120. 'formatters': {
  121. 'verbose': {
  122. 'format': '%(levelname)s %(asctime)s %(module)s %(message)s',
  123. },
  124. 'simple': {
  125. 'format': '[%(asctime)s] %(message)s'
  126. },
  127. },
  128. 'handlers': {
  129. 'null': {
  130. 'level': 'DEBUG',
  131. 'class': 'django.utils.log.NullHandler',
  132. },
  133. 'console': {
  134. 'level': 'DEBUG',
  135. 'class': 'logging.StreamHandler',
  136. 'formatter': 'verbose'
  137. },
  138. 'checkout_file': {
  139. 'level': 'INFO',
  140. 'class': 'oscar.core.logging.handlers.EnvFileHandler',
  141. 'filename': 'checkout.log',
  142. 'formatter': 'verbose'
  143. },
  144. 'gateway_file': {
  145. 'level': 'INFO',
  146. 'class': 'oscar.core.logging.handlers.EnvFileHandler',
  147. 'filename': 'gateway.log',
  148. 'formatter': 'simple'
  149. },
  150. 'error_file': {
  151. 'level': 'INFO',
  152. 'class': 'oscar.core.logging.handlers.EnvFileHandler',
  153. 'filename': 'errors.log',
  154. 'formatter': 'verbose'
  155. },
  156. 'mail_admins': {
  157. 'level': 'ERROR',
  158. 'class': 'django.utils.log.AdminEmailHandler',
  159. },
  160. },
  161. 'loggers': {
  162. 'django': {
  163. 'handlers': ['null'],
  164. 'propagate': True,
  165. 'level': 'INFO',
  166. },
  167. 'django.request': {
  168. 'handlers': ['mail_admins', 'error_file'],
  169. 'level': 'ERROR',
  170. 'propagate': False,
  171. },
  172. 'oscar.checkout': {
  173. 'handlers': ['console', 'checkout_file'],
  174. 'propagate': True,
  175. 'level': 'INFO',
  176. },
  177. 'gateway': {
  178. 'handlers': ['gateway_file'],
  179. 'propagate': True,
  180. 'level': 'INFO',
  181. },
  182. 'django.db.backends': {
  183. 'handlers': ['null'],
  184. 'propagate': False,
  185. 'level': 'DEBUG',
  186. },
  187. }
  188. }
  189. INSTALLED_APPS = [
  190. 'django.contrib.auth',
  191. 'django.contrib.contenttypes',
  192. 'django.contrib.sessions',
  193. 'django.contrib.sites',
  194. 'django.contrib.messages',
  195. 'django.contrib.admin',
  196. 'django.contrib.flatpages',
  197. 'django.contrib.staticfiles',
  198. 'django_extensions',
  199. 'debug_toolbar',
  200. 'south',
  201. 'rosetta', # For i18n testing
  202. 'apps.user', # For profile testing
  203. 'apps.gateway', # For allowing dashboard access
  204. ]
  205. from oscar import get_core_apps
  206. INSTALLED_APPS = INSTALLED_APPS + get_core_apps()
  207. AUTHENTICATION_BACKENDS = (
  208. 'oscar.apps.customer.auth_backends.Emailbackend',
  209. 'django.contrib.auth.backends.ModelBackend',
  210. )
  211. LOGIN_REDIRECT_URL = '/accounts/'
  212. APPEND_SLASH = True
  213. # Haystack settings
  214. HAYSTACK_CONNECTIONS = {
  215. 'default': {
  216. 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
  217. 'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
  218. },
  219. }
  220. DEBUG_TOOLBAR_CONFIG = {
  221. 'INTERCEPT_REDIRECTS': False,
  222. }
  223. AUTH_PROFILE_MODULE = 'user.Profile'
  224. # Oscar settings
  225. from oscar.defaults import *
  226. OSCAR_RECENTLY_VIEWED_PRODUCTS = 20
  227. OSCAR_ALLOW_ANON_CHECKOUT = True
  228. OSCAR_INITIAL_ORDER_STATUS = 'Pending'
  229. OSCAR_INITIAL_LINE_STATUS = 'Pending'
  230. OSCAR_ORDER_STATUS_PIPELINE = {
  231. 'Pending': ('Being processed', 'Cancelled',),
  232. 'Being processed': ('Processed', 'Cancelled',),
  233. 'Cancelled': (),
  234. }
  235. OSCAR_SHOP_NAME = 'Oscar Sandbox'
  236. OSCAR_SHOP_TAGLINE = 'e-Commerce for Django'
  237. GOOGLE_ANALYTICS_ID = 'UA-XXXXX-Y'
  238. LOG_ROOT = location('logs')
  239. DISPLAY_VERSION = False
  240. THUMBNAIL_DEBUG = True
  241. # Must be within MEDIA_ROOT for sorl to work
  242. OSCAR_MISSING_IMAGE_URL = 'image_not_found.jpg'
  243. try:
  244. from settings_local import *
  245. except ImportError:
  246. pass