cciw-website / cciw / settings.py

Luke Plant 322333d 
Luke Plant 1d4565b 
Luke Plant 322333d 
Luke Plant 02c3d40 
Luke Plant 1d4565b 
Luke Plant 322333d 
Luke Plant 1d4565b 
Luke Plant 989566f 

Luke Plant 1d4565b 
Luke Plant 322333d 
Luke Plant ca7e4d0 
Luke Plant 322333d 
Luke Plant 7be04bc 
Luke Plant b4e7897 
Luke Plant 7be04bc 
Luke Plant 7d4c40d 

Luke Plant 02c3d40 

Luke Plant 322333d 

Luke Plant 7a3fdf6 

Luke Plant 322333d 


Luke Plant 17c3010 


Luke Plant 322333d 

















Luke Plant 47c11cc 




Luke Plant 02c3d40 
Luke Plant 322333d 


Luke Plant a75c950 
Luke Plant 322333d 









Luke Plant 3585aa1 
Luke Plant 97ccf87 
Luke Plant 322333d 

Luke Plant 0e41d0c 
Luke Plant ed98f14 
Luke Plant bdfc2ab 
Luke Plant 72c8994 
Luke Plant d6a3fac 
Luke Plant 051f699 
Luke Plant 02c3d40 


Luke Plant 83649af 
Luke Plant 02c3d40 
Luke Plant 17c3010 
Luke Plant e1aa811 
Luke Plant 23ca94b 
Luke Plant 322333d 
Luke Plant 83649af 
Luke Plant 322333d 
Luke Plant ac45b21 
Luke Plant 322333d 


Luke Plant 83649af 



Luke Plant 322333d 
Luke Plant 8ec6d69 




Luke Plant 322333d 


Luke Plant 5be7f06 





Luke Plant ca474b4 
Luke Plant 5be7f06 


Luke Plant 322333d 
Luke Plant 5be7f06 
Luke Plant 322333d 
Luke Plant 6de3c35 

Luke Plant 7be04bc 
Luke Plant 6de3c35 
Luke Plant 3bb2309 
Luke Plant 6de3c35 
Luke Plant 322333d 






Luke Plant 108990c 

Luke Plant 322333d 

Luke Plant 17c3010 

Luke Plant ff6092e 
Luke Plant 17c3010 
Luke Plant 407cd8e 
Luke Plant 17c3010 
Luke Plant 322333d 
Luke Plant 17c3010 



Luke Plant 322333d 

Luke Plant e93ff62 
Luke Plant af33ead 
Luke Plant e4aa3bf 



Luke Plant e93ff62 
Luke Plant 322333d 
Luke Plant 0b05589 


Luke Plant 1a4725f 
Luke Plant 322333d 









Luke Plant 5b69559 
Luke Plant 322333d 



Luke Plant 7a3fdf6 







Luke Plant 17c3010 
Luke Plant 1b3195d 

Luke Plant 7a3fdf6 
Luke Plant 17c3010 
Luke Plant 7a3fdf6 
Luke Plant e2a3486 

Luke Plant 7a3fdf6 

Luke Plant 88a97e7 

Luke Plant 7a3fdf6 
Luke Plant e2a3486 
Luke Plant 7a3fdf6 
Luke Plant 322333d 


Luke Plant d283345 
Luke Plant ca7e4d0 
Luke Plant 322333d 
Luke Plant 1ab8c54 
Luke Plant 9f0035a 
Luke Plant 9f97938 
Luke Plant d025dd4 
Luke Plant 322333d 
Luke Plant ed98f14 
Luke Plant 322333d 

Luke Plant 9775b05 
Luke Plant 7736bdc 
Luke Plant 322333d 

Luke Plant 3f9c8df 
Luke Plant 322333d 


Luke Plant 108990c 



Luke Plant 322333d 

Luke Plant 17c3010 
Luke Plant 989566f 

Luke Plant 17c3010 
Luke Plant 989566f 




Luke Plant 1d4565b 
Luke Plant 17c3010 
Luke Plant ff6092e 
Luke Plant 17c3010 
Luke Plant 322333d 

Luke Plant d6a3fac 


Luke Plant 9775b05 
Luke Plant d6a3fac 


Luke Plant 322333d 



Luke Plant f010950 
Luke Plant 322333d 






Luke Plant fe935f6 
Luke Plant 322333d 
Luke Plant 3dc66e9 

Luke Plant 3b52491 
Luke Plant 322333d 




Luke Plant 2985396 
Luke Plant 322333d 
Luke Plant 945fa58 
Luke Plant 1d4565b 
Luke Plant 3647716 

Luke Plant b8acc5e 


Luke Plant 1d4565b 
Luke Plant 322333d 
Luke Plant 8942705 
Luke Plant 7b8dbea 

Luke Plant 322333d 

Luke Plant 8942705 
Luke Plant 322333d 




Luke Plant 9f97938 
Luke Plant 0df301d 
Luke Plant bdfc2ab 
Luke Plant 1256219 
Luke Plant f154d4a 
# Settings file
import os
import socket
import sys

hostname = socket.gethostname()

basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # ../
parentdir = os.path.dirname(basedir)

DEVBOX = ('webfaction' not in hostname)
LIVEBOX = not DEVBOX

if LIVEBOX:
    from cciw.settings_priv import PRODUCTION, STAGING, GOOGLE_ANALYTICS_ACCOUNT

from cciw.settings_priv import PAYPAL_TEST, PAYPAL_RECEIVER_EMAIL

WEBSERVER_RUNNING = 'mod_wsgi' in sys.argv

### MISC ###

from cciw.settings_priv import SECRET_KEY

if DEVBOX:
    DEBUG = True
    TEMPLATE_DEBUG = True
    DEBUG_TOOLBAR_CONFIG = {
        'INTERCEPT_REDIRECTS': False,
    }
else:
    DEBUG = False
    TEMPLATE_DEBUG = False

INTERNAL_IPS = ('127.0.0.1',)

ADMINS = (
    ('Luke Plant', 'L.Plant.98@cantab.net'),
)

MANAGERS = ADMINS

LANGUAGE_CODE = 'en-gb'

SITE_ID = 1

ROOT_URLCONF = 'cciw.urls'

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
        }
    }

TIME_ZONE = "Europe/London"

USE_I18N = False
USE_TZ = False

LOGIN_URL = "/officers/"

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.admin',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'cciw.cciwmain',
    'cciw.sitecontent',
    'cciw.forums',
    'cciw.officers',
    'cciw.utils',
    'cciw.bookings',
    'django.contrib.messages',
    'securedownload',
    'autocomplete',
    'djiki',
    'paypal.standard.ipn',
)

if not (LIVEBOX and WEBSERVER_RUNNING):
    # Don't want the memory overhead of these if we are serving requests
    INSTALLED_APPS += (
    'django.contrib.staticfiles',
    'south',
    )

if DEVBOX and DEBUG:
    INSTALLED_APPS += (
        'django.contrib.admindocs',
        'debug_toolbar',
    )

if DEVBOX:
    INSTALLED_APPS += (
        'anonymizer',
)

if LIVEBOX and PRODUCTION:
    INSTALLED_APPS += (
    'mailer',
)

######  DATABASE   ####

if DEVBOX:
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': 'cciw',
            'USER': 'cciw',
            'PASSWORD': 'foo',
            'HOST': 'localhost',
            'PORT': 5432
            }
        }
else:
    from cciw.settings_priv import DATABASES

###### SESSIONS ########

if LIVEBOX and PRODUCTION:
    SESSION_COOKIE_SECURE = True
    CSRF_COOKIE_SECURE = True

######  TEMPLATES  ###########

TEMPLATE_DIRS = (
    basedir + r'/templates',
)

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = [
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.core.context_processors.request",
    "django.contrib.auth.context_processors.auth",
    "django.contrib.messages.context_processors.messages",
    "cciw.cciwmain.common.standard_processor",
]

if DEBUG:
    TEMPLATE_CONTEXT_PROCESSORS.append("django.core.context_processors.debug")

#####  EMAIL  #######

if LIVEBOX:
    if PRODUCTION:
        EMAIL_BACKEND = "mailer.backend.DbBackend"
    elif STAGING:
        EMAIL_BACKEND = "cciw.mail.backend.StagingBackend"

if DEVBOX:
    EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
    # For more advanced e-mail testing which requires the exact email dumped to
    # a file, disable the above line and run:
    #  fakemail.py --path=/home/luke/devel/cciw.co.uk/tests/mail --background
    EMAIL_HOST = 'localhost'
    EMAIL_HOST_USER = None
    EMAIL_HOST_PASSWORD = None
    EMAIL_PORT = 8025

    SEND_BROKEN_LINK_EMAILS = True

else:
    SERVER_EMAIL = "website@cciw.co.uk"
    DEFAULT_FROM_EMAIL = SERVER_EMAIL
    EMAIL_HOST = "smtp.webfaction.com"
    from cciw.settings_priv import EMAIL_HOST_USER, EMAIL_HOST_PASSWORD

    SEND_BROKEN_LINK_EMAILS = False

##### MAILING LISTS ######

if LIVEBOX:
    from cciw.settings_priv import MAILBOX_PASSWORD, IMAP_MAIL_SERVER

##### WEBFACTION #####

if LIVEBOX:
    from cciw.settings_priv import WEBFACTION_PASSWORD, WEBFACTION_USER
else:
    WEBFACTION_USER, WEBFACTION_PASSWORD = None, None

##### SECUREDOWNLOAD #####

SECUREDOWNLOAD_SERVE_URL = "/file/"
SECUREDOWNLOAD_TIMEOUT = 3600

if DEVBOX:
    SECUREDOWNLOAD_SOURCE = os.path.join(parentdir, "secure_downloads_src")
    SECUREDOWNLOAD_SERVE_ROOT = os.path.join(parentdir, "secure_downloads")
else:
    from cciw.settings_priv import SECUREDOWNLOAD_SOURCE, SECUREDOWNLOAD_SERVE_ROOT

### MIDDLEWARE_CLASSES ####

_MIDDLEWARE_CLASSES = (
    (DEVBOX,     "cciw.middleware.http.ActAsProxy"),
    (LIVEBOX,    "cciw.middleware.http.WebFactionFixes"),
    (True,       "django.middleware.gzip.GZipMiddleware"),
    (DEVBOX,     "debug_toolbar.middleware.DebugToolbarMiddleware"),
    (DEVBOX and DEBUG, "cciw.middleware.debug.DebugMiddleware"),
    (True,       'django.middleware.csrf.CsrfViewMiddleware'),
    (True,       'django.middleware.clickjacking.XFrameOptionsMiddleware'),
    (True,       "django.contrib.sessions.middleware.SessionMiddleware"),
    (True,       "django.contrib.messages.middleware.MessageMiddleware"),
    (True,       "django.contrib.auth.middleware.AuthenticationMiddleware"),
    (True,       "django.middleware.common.CommonMiddleware"),
    (True,       "cciw.middleware.auth.PrivateWiki"),
    (True,       "django.middleware.transaction.TransactionMiddleware"),
    (True,       "cciw.middleware.threadlocals.ThreadLocals"),
)
DATABASE_ENGINE='postgresql'

MIDDLEWARE_CLASSES = tuple([val for (test, val) in _MIDDLEWARE_CLASSES if test])

####### MESSAGES ##########

MESSAGE_STORAGE = "django.contrib.messages.storage.fallback.FallbackStorage"

####### MEDIA #############

if DEVBOX:
    MEDIA_ROOT = os.path.join(parentdir, 'usermedia')
    STATIC_ROOT = os.path.join(parentdir, 'static')
else:
    # Need this to be relative to current. At the time this is used, the
    # directory above STATIC_ROOT will be one of many timestamped directories,
    # and we can't use the 'current' symlink.
    STATIC_ROOT = os.path.join(parentdir, 'static')
    from cciw.settings_priv import MEDIA_ROOT

MEDIA_URL = '/usermedia/'
STATIC_URL = '/static/'

FILE_UPLOAD_MAX_MEMORY_SIZE = 262144

#####  DJIKI  ######

DJIKI_IMAGES_PATH = 'wiki/images/'
DJIKI_ALLOW_ANONYMOUS_EDITS = False

####################

## CCIW SPECIFIC SETTINGS AND CONSTANTS
AWARD_UPLOAD_PATH = 'images/awards'
MEMBER_ICON_UPLOAD_PATH = 'images/members/temp'
MEMBER_ICON_PATH = 'images/members'
DEFAULT_MEMBER_ICON = 'defaultmember.png'
MEMBER_ICON_MAX_SIZE = 48

CAMP_FORUM_RE = r'camps/(?P<year>\d{4})/(?P<number>\d+|all)/forum/'

FORUM_PAGINATE_POSTS_BY = 20
FORUM_PAGINATE_PHOTOS_BY = 20
FORUM_PAGINATE_TOPICS_BY = 30
FORUM_PAGINATE_NEWS_BY = 10
ESV_BROWSE_URL = "http://www.gnpcb.org/esv/search/"
FEEDBACK_EMAIL = "feedback@cciw.co.uk"
BOOKING_SECRETARY_EMAIL = "bookings@cciw.co.uk"
BOOKING_FORM_EMAIL = "bookingforms@cciw.co.uk"
BOOKINGFORMDIR = "downloads"
MEMBERS_PAGINATE_MESSAGES_BY = 20
WEBMASTER_EMAIL = "webmaster@cciw.co.uk"
LIST_MAILBOX_NAME = "camplists"
LIST_MAIL_DEBUG_ADDRESSES = [
    WEBMASTER_EMAIL
]
REFERENCE_CONCERNS_CONTACT_DETAILS = "Shirley Evans on 020 8569 0669."
ESV_KEY = 'IP'
CRB_VALID_FOR = 365 * 3 # We consider a CRB valid for 3 years

## Bookings ##
BOOKING_EMAIL_VERIFY_TIMEOUT_DAYS = 3
BOOKING_SESSION_TIMEOUT_SECONDS = 60*60*24*14 # 2 weeks

if DEVBOX:
    OUTPUT_VALIDATOR_VALIDATORS = {
        'text/html': '/home/luke/devel/myvalidate.sh',
        'application/xml+xhtml': '/home/luke/devel/myvalidate.sh',
    }

    OUTPUT_VALIDATOR_IGNORE_PATHS = (
    )

    FIXTURE_DIRS = [
        basedir + r'/cciw/cciwmain/fixtures'
    ]

DEFAULT_CONTENT_TYPE = "text/html"

BASE_DIR = basedir

PAYPAL_IMAGE = "https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_LG.gif"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.