Permalink
Browse files

Added alternative files for an oscar install

  • Loading branch information...
codeinthehole committed May 10, 2012
1 parent 5919539 commit 13ba836611493c5f49ed2cd544307be414e8b564
Showing with 289 additions and 0 deletions.
  1. +258 −0 www/conf/default_oscar.py
  2. +8 −0 www/deploy/requirements_oscar.txt
  3. +23 −0 www/urls_oscar.py
View
@@ -0,0 +1,258 @@
+# -*- coding: utf-8 -*-
+
+import os
+
+location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', x)
+
+DEBUG = False
+
+ADMINS = (
+ ('Alerts', 'alerts.{{ project_code }}@{{ domain }}'),
+)
+
+MANAGERS = ADMINS
+
+# Local time zone for this installation. Choices can be found here:
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+# although not all choices may be available on all operating systems.
+# On Unix systems, a value of None will cause Django to use the same
+# timezone as the operating system.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+TIME_ZONE = '{{ timezone }}'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = '{{ language_code }}'
+
+SITE_ID = 1
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+
+# If you set this to False, Django will not format dates, numbers and
+# calendars according to the current locale
+USE_L10N = True
+
+# Absolute filesystem path to the directory that will hold user-uploaded files.
+# Example: "/home/media/media.lawrence.com/media/"
+MEDIA_ROOT = location('public/media')
+
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash.
+# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
+MEDIA_URL = '/media/'
+
+# Absolute path to the directory static files should be collected to.
+# Don't put anything in this directory yourself; store your static files
+# in apps' "static/" subdirectories and in STATICFILES_DIRS.
+# Example: "/home/media/media.lawrence.com/static/"
+STATIC_ROOT = location('public/static/')
+
+# URL prefix for static files.
+# Example: "http://media.lawrence.com/static/"
+STATIC_URL = '/static/'
+
+# URL prefix for admin static files -- CSS, JavaScript and images.
+# Make sure to use a trailing slash.
+# Examples: "http://foo.com/static/admin/", "/static/admin/".
+ADMIN_MEDIA_PREFIX = '/static/admin/'
+
+# Additional locations of static files
+STATICFILES_DIRS = (
+ location('static/'),
+)
+
+# List of finder classes that know how to find static files in
+# various locations.
+STATICFILES_FINDERS = (
+ 'django.contrib.staticfiles.finders.FileSystemFinder',
+ 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+ 'compressor.finders.CompressorFinder',
+)
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = '{{ secret_key }}'
+
+# List of callables that know how to import templates from various sources.
+TEMPLATE_LOADERS = (
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+)
+
+TEMPLATE_CONTEXT_PROCESSORS = (
+ "django.contrib.auth.context_processors.auth",
+ "django.core.context_processors.request",
+ "django.core.context_processors.debug",
+ "django.core.context_processors.i18n",
+ "django.core.context_processors.media",
+ "django.core.context_processors.static",
+ "django.contrib.messages.context_processors.messages",
+ # Oscar specific
+ 'oscar.apps.search.context_processors.search_form',
+ 'oscar.apps.promotions.context_processors.promotions',
+ 'oscar.apps.checkout.context_processors.checkout',
+ 'oscar.core.context_processors.metadata',
+)
+
+MIDDLEWARE_CLASSES = (
+ 'django.middleware.common.CommonMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.transaction.TransactionMiddleware',
+ 'debug_toolbar.middleware.DebugToolbarMiddleware',
+ 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
+ 'oscar.apps.basket.middleware.BasketMiddleware',
+)
+
+ROOT_URLCONF = 'urls'
+
+TEMPLATE_DIRS = (
+ location('templates'),
+)
+
+INSTALLED_APPS = [
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'django.contrib.messages',
+ 'django.contrib.admin',
+ 'django.contrib.flatpages',
+ 'django.contrib.staticfiles',
+ 'south', # Do not change the position of south in this list unless specificall instructed to by installation instructions
+ 'django_extensions',
+ 'debug_toolbar',
+]
+
+from oscar import get_core_apps
+INSTALLED_APPS += get_core_apps()
+
+# This is set as in a HTML comment at the bottom of the page
+HOSTNAME = 'N/A'
+
+# A sample logging configuration. The only tangible logging
+# performed by this configuration is to send an email to
+# the site admins on every HTTP 500 error.
+# See http://docs.djangoproject.com/en/dev/topics/logging for
+# more details on how to customize your logging configuration.
+LOG_ROOT = location('../logs/')
+
+SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
+SESSION_COOKIE_HTTPONLY = True
+
+AUTHENTICATION_BACKENDS = (
+ 'oscar.apps.customer.auth_backends.Emailbackend',
+ 'django.contrib.auth.backends.ModelBackend',
+)
+
+DATE_FORMAT = 'd/m/Y'
+DATETIME_FORMAT = 'd/m/Y H:i:s'
+
+USE_SSL = False
+USE_GOOGLE_ANALYTICS = False
+LOGIN_REDIRECT_URL = '/accounts/'
+
+# For displaying version
+DISPLAY_VERSION = False
+
+# Disabled for local but enabled in real envs
+COMPRESS_ENABLED = False
+COMPRESS_OUTPUT_DIR = 'cache'
+COMPRESS_CACHE_KEY_FUNCTION = 'compressor.cache.socket_cachekey'
+COMPRESS_OFFLINE = True
+
+# Haystack settings
+HAYSTACK_SITECONF = 'oscar.search_sites'
+HAYSTACK_SEARCH_ENGINE = 'dummy'
+
+CACHES = {
+ 'default': {
+ 'BACKEND':
+ 'django.core.cache.backends.memcached.MemcachedCache',
+ 'LOCATION': '127.0.0.1:11211',
+ }
+}
+
+LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': False,
+ 'formatters': {
+ 'verbose': {
+ 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
+ },
+ 'simple': {
+ 'format': '%(levelname)s %(message)s'
+ },
+ },
+ 'handlers': {
+ 'null': {
+ 'level':'DEBUG',
+ 'class':'django.utils.log.NullHandler',
+ },
+ 'console':{
+ 'level':'DEBUG',
+ 'class':'logging.StreamHandler',
+ 'formatter': 'verbose'
+ },
+ 'checkout_file': {
+ 'level': 'INFO',
+ 'class': 'oscar.core.logging.handlers.EnvFileHandler',
+ 'filename': 'checkout.log',
+ 'formatter': 'verbose'
+ },
+ 'error_file': {
+ 'level': 'INFO',
+ 'class': 'oscar.core.logging.handlers.EnvFileHandler',
+ 'filename': 'errors.log',
+ 'formatter': 'verbose'
+ },
+ 'mail_admins': {
+ 'level': 'ERROR',
+ 'class': 'django.utils.log.AdminEmailHandler',
+ },
+ },
+ 'loggers': {
+ 'django.request': {
+ 'handlers': ['mail_admins'],
+ 'level': 'ERROR',
+ 'propagate': False,
+ },
+ 'management_commands': {
+ 'handlers': ['mail_admins'],
+ 'level': 'ERROR',
+ 'propagate': False,
+ },
+ 'oscar.checkout': {
+ 'handlers': ['console', 'checkout_file'],
+ 'propagate': True,
+ 'level':'INFO',
+ },
+ }
+}
+
+INTERNAL_IPS = ('127.0.0.1', '33.33.33.1', '10.0.2.2')
+
+DEBUG_TOOLBAR_CONFIG = {
+ 'INTERCEPT_REDIRECTS': False
+}
+
+# Oscar settings
+from oscar.defaults import *
+
+OSCAR_ALLOW_ANON_CHECKOUT = True
+OSCAR_INITIAL_ORDER_STATUS = 'Pending'
+OSCAR_INITIAL_LINE_STATUS = 'Pending'
+OSCAR_ORDER_STATUS_PIPELINE = {
+ 'Pending': ('Being processed', 'Cancelled',),
+ 'Being processed': ('Processed', 'Cancelled',),
+ 'Cancelled': (),
+}
+
+OSCAR_SHOP_NAME = '{{ client }} / {{ project_code }}'
+OSCAR_SHOP_TAGLINE = ''
+
+GOOGLE_ANALYTICS_ID = 'UA-XXXXX-Y'
@@ -0,0 +1,8 @@
+Django==1.4
+MySQL-python==1.2.3

This comment has been minimized.

Show comment Hide comment
@Geekfish

Geekfish Jun 5, 2012

I believe this should be swapped to a postgres dependency, together with the test/stage/prod settings? happy to do that if everyone else is happy with the change.

@Geekfish

Geekfish Jun 5, 2012

I believe this should be swapped to a postgres dependency, together with the test/stage/prod settings? happy to do that if everyone else is happy with the change.

+South==0.7.3
+django-debug-toolbar==0.9.4
+django-extensions==0.7.1
+python-memcached==1.47
+Fabric==1.4.0
+django-oscar
View
@@ -0,0 +1,23 @@
+from django.conf import settings
+from django.contrib import admin
+from django.conf.urls.defaults import patterns, include, url
+from django.conf.urls.static import static
+from django.contrib.staticfiles.urls import staticfiles_urlpatterns
+
+from oscar.app import shop
+from oscar.views import handler500, handler404
+
+admin.autodiscover()
+
+urlpatterns = patterns('',
+ (r'^admin/', include(admin.site.urls)),
+ (r'', include(shop.urls)),
+)
+
+if settings.DEBUG:
+ urlpatterns += staticfiles_urlpatterns()
+ urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+ urlpatterns += patterns('',
+ url(r'^404$', handler404),
+ url(r'^500$', handler500)
+ )

0 comments on commit 13ba836

Please sign in to comment.