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 7.9KB

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