2009-07-13 08:09:58 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
2009-07-12 17:11:33 +00:00
|
|
|
# Django settings for oxdata project.
|
2009-07-13 08:09:58 +00:00
|
|
|
import os
|
2016-03-06 10:35:46 +00:00
|
|
|
from os.path import join, normpath, dirname
|
|
|
|
import djcelery
|
|
|
|
djcelery.setup_loader()
|
2009-07-13 08:09:58 +00:00
|
|
|
|
2011-10-14 09:03:43 +00:00
|
|
|
SITENAME = 'oxdata'
|
|
|
|
|
2016-03-06 10:35:46 +00:00
|
|
|
BASE_DIR = PROJECT_ROOT = normpath(dirname(__file__))
|
2009-07-12 17:11:33 +00:00
|
|
|
|
2011-07-30 11:08:47 +00:00
|
|
|
DEBUG = False
|
2009-07-12 17:11:33 +00:00
|
|
|
TEMPLATE_DEBUG = DEBUG
|
2010-08-11 12:42:47 +00:00
|
|
|
JSON_DEBUG = DEBUG
|
2009-07-12 17:11:33 +00:00
|
|
|
|
|
|
|
ADMINS = (
|
|
|
|
# ('Your Name', 'your_email@domain.com'),
|
|
|
|
)
|
|
|
|
|
|
|
|
MANAGERS = ADMINS
|
|
|
|
|
2011-10-16 18:26:10 +00:00
|
|
|
DATABASES = {
|
2011-07-30 11:08:47 +00:00
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
|
|
'NAME': 'dev.sqlite'
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 17:11:33 +00:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
# If running in a Windows environment this must be set to the same as your
|
|
|
|
# system time zone.
|
2016-03-06 10:35:46 +00:00
|
|
|
TIME_ZONE = 'UTC'
|
2009-07-12 17:11:33 +00:00
|
|
|
|
|
|
|
# Language code for this installation. All choices can be found here:
|
|
|
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
2011-04-06 15:51:49 +00:00
|
|
|
|
|
|
|
#with apache x-sendfile or lighttpd set this to True
|
|
|
|
XSENDFILE = False
|
|
|
|
|
|
|
|
#with nginx X-Accel-Redirect set this to True
|
|
|
|
XACCELREDIRECT = False
|
|
|
|
|
2013-07-15 19:45:29 +00:00
|
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
2011-04-06 15:51:49 +00:00
|
|
|
|
2009-07-12 17:11:33 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
# Absolute path to the directory that holds media.
|
|
|
|
# Example: "/home/media/media.lawrence.com/"
|
2009-09-07 15:29:39 +00:00
|
|
|
MEDIA_ROOT = join(PROJECT_ROOT, 'media')
|
|
|
|
STATIC_ROOT = join(PROJECT_ROOT, 'static')
|
|
|
|
DATA_ROOT = join(PROJECT_ROOT, 'data')
|
|
|
|
CACHE_ROOT = join(PROJECT_ROOT, 'cache')
|
2009-07-15 16:39:28 +00:00
|
|
|
|
2016-03-06 10:35:46 +00:00
|
|
|
STATIC_URL = '/static/'
|
|
|
|
|
|
|
|
# Additional locations of static files
|
|
|
|
STATICFILES_DIRS = (
|
|
|
|
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
|
|
|
# Always use forward slashes, even on Windows.
|
|
|
|
# Don't forget to use absolute paths, not relative paths.
|
|
|
|
)
|
|
|
|
|
|
|
|
# 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',
|
|
|
|
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
|
|
|
)
|
|
|
|
|
2011-11-01 17:38:48 +00:00
|
|
|
os.environ['oxCACHE'] = 'fs:' + CACHE_ROOT
|
2009-07-13 08:09:58 +00:00
|
|
|
|
2009-07-12 17:11:33 +00:00
|
|
|
|
|
|
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
|
|
|
# trailing slash if there is a path component (optional in other cases).
|
|
|
|
# Examples: "http://media.lawrence.com", "http://example.com/media/"
|
2009-07-13 08:09:58 +00:00
|
|
|
MEDIA_URL = '/media/'
|
2009-07-12 17:11:33 +00:00
|
|
|
|
|
|
|
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
|
|
|
# trailing slash.
|
|
|
|
# Examples: "http://foo.com/media/", "/media/".
|
2009-07-13 08:09:58 +00:00
|
|
|
ADMIN_MEDIA_PREFIX = '/admin/media/'
|
2009-07-12 17:11:33 +00:00
|
|
|
|
2016-03-06 10:35:46 +00:00
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
join(PROJECT_ROOT, 'templates'),
|
|
|
|
],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
'OPTIONS': {
|
|
|
|
'context_processors': [
|
|
|
|
'django.template.context_processors.debug',
|
|
|
|
'django.template.context_processors.request',
|
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
2011-10-18 14:02:14 +00:00
|
|
|
|
2009-07-12 17:11:33 +00:00
|
|
|
MIDDLEWARE_CLASSES = (
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
2016-03-06 10:35:46 +00:00
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
2009-07-12 17:11:33 +00:00
|
|
|
)
|
|
|
|
|
2016-03-06 10:35:46 +00:00
|
|
|
ROOT_URLCONF = 'urls'
|
2009-07-12 17:11:33 +00:00
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
2016-03-06 10:35:46 +00:00
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
2009-07-13 14:44:09 +00:00
|
|
|
'django.contrib.admin',
|
2009-07-13 08:09:58 +00:00
|
|
|
'django.contrib.humanize',
|
2011-10-14 09:03:43 +00:00
|
|
|
'django_extensions',
|
2010-08-08 12:39:37 +00:00
|
|
|
'djcelery',
|
2009-07-13 08:09:58 +00:00
|
|
|
|
2011-10-14 09:03:43 +00:00
|
|
|
'lookup',
|
|
|
|
'movie',
|
|
|
|
'poster',
|
|
|
|
'cover',
|
2009-07-12 17:11:33 +00:00
|
|
|
)
|
2009-07-13 08:09:58 +00:00
|
|
|
|
|
|
|
LOGIN_REDIRECT_URL='/'
|
|
|
|
|
2010-08-05 11:47:19 +00:00
|
|
|
|
2016-03-06 10:35:46 +00:00
|
|
|
CELERY_RESULT_BACKEND = 'database'
|
|
|
|
CELERY_TASK_SERIALIZER = 'json'
|
|
|
|
CELERY_RESULT_SERIALIZER = 'json'
|
|
|
|
CELERY_ACCEPT_CONTENT = ['json']
|
|
|
|
|
|
|
|
BROKER_URL = 'amqp://oxdata:ox@localhost:5672//odata'
|
2010-08-08 12:39:37 +00:00
|
|
|
|
2011-10-14 09:03:43 +00:00
|
|
|
#Movie related settings
|
|
|
|
REVIEW_WHITELIST = {
|
|
|
|
u'.filmcritic.com': u'Filmcritic',
|
|
|
|
u'metacritic.com': u'Metacritic',
|
|
|
|
u'nytimes.com': u'New York Times',
|
|
|
|
u'rottentomatoes.com': u'Rotten Tomatoes',
|
|
|
|
u'salon.com': u'Salon.com',
|
|
|
|
u'sensesofcinema.com': u'Senses of Cinema',
|
2011-12-20 14:29:41 +00:00
|
|
|
u'villagevoice.com': u'Village Voice',
|
|
|
|
u'washingtonpost.com': u'Washington Post',
|
|
|
|
u'rogerebert.suntimes.com': u'Chicago Sun-Times',
|
|
|
|
u'sfgate.com': u'San Francisco Chronicle',
|
|
|
|
u'rollingstone.com': u'Rolling Stone'
|
2011-10-14 09:03:43 +00:00
|
|
|
}
|
|
|
|
|
2009-09-07 15:29:39 +00:00
|
|
|
#overwrite default settings with local settings
|
|
|
|
try:
|
|
|
|
from local_settings import *
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
# Make this unique, creates random key first at first time.
|
2009-07-14 10:51:49 +00:00
|
|
|
try:
|
2009-09-07 15:29:39 +00:00
|
|
|
SECRET_KEY
|
|
|
|
except NameError:
|
|
|
|
SECRET_FILE = os.path.join(PROJECT_ROOT, 'secret.txt')
|
|
|
|
try:
|
|
|
|
SECRET_KEY = open(SECRET_FILE).read().strip()
|
|
|
|
except IOError:
|
|
|
|
try:
|
|
|
|
from random import choice
|
|
|
|
SECRET_KEY = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
|
|
|
|
secret = file(SECRET_FILE, 'w')
|
|
|
|
secret.write(SECRET_KEY)
|
|
|
|
secret.close()
|
|
|
|
except IOError:
|
|
|
|
Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)
|
2009-07-14 10:51:49 +00:00
|
|
|
|