NewsBlur/settings.py

263 lines
7.7 KiB
Python
Raw Normal View History

import sys
import logging
import os
# Route all 'print' statements to Apache
sys.stdout = sys.stderr
# ===========================
# = Directory Declaractions =
# ===========================
CURRENT_DIR = os.path.dirname(__file__)
NEWSBLUR_DIR = CURRENT_DIR
TEMPLATE_DIRS = (''.join([CURRENT_DIR, '/templates']),)
MEDIA_ROOT = ''.join([CURRENT_DIR, '/media'])
2009-09-08 03:15:49 +00:00
UTILS_ROOT = ''.join([CURRENT_DIR, '/utils'])
LOG_FILE = ''.join([CURRENT_DIR, '/logs/newsblur.log'])
2009-09-08 03:15:49 +00:00
# ==============
# = PYTHONPATH =
# ==============
2009-09-08 03:39:46 +00:00
COMPRESS_DIR = ''.join([CURRENT_DIR, '/utils/djangocompress'])
if 'djangocompress' not in ' '.join(sys.path):
2009-09-08 03:15:49 +00:00
sys.path.append(COMPRESS_DIR)
DJANGO_DEBUG_DIR = ''.join([CURRENT_DIR, '/utils/django-debug-toolbar'])
if 'debug-toolbar' not in ' '.join(sys.path):
sys.path.append(DJANGO_DEBUG_DIR)
2009-09-08 03:15:49 +00:00
# ===================
# = Global Settings =
# ===================
2009-06-16 03:08:55 +00:00
DEBUG = True
2009-06-16 03:08:55 +00:00
ADMINS = (
('Samuel Clay', 'samuel@ofbrooklyn.com'),
2009-06-16 03:08:55 +00:00
)
MANAGERS = ADMINS
TIME_ZONE = 'America/New_York'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = False
LOGIN_REDIRECT_URL = '/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/admin/'
SECRET_KEY = '6yx-@2u@v$)-=fqm&tc8lhk3$6d68+c7gd%p$q2@o7b4o8-*fz'
# ===============
# = Enviornment =
# ===============
PRODUCTION = __file__.find('/home/conesus/newsblur') == 0
2009-07-25 02:21:12 +00:00
STAGING = __file__.find('/home/conesus/stg-newsblur') == 0
DEV_SERVER1 = __file__.find('/Users/conesus/Projects/newsblur') == 0
DEV_SERVER2 = __file__.find('/Users/conesus/newsblur') == 0
DEVELOPMENT = DEV_SERVER1 or DEV_SERVER2
if PRODUCTION:
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'newsblur'
DATABASE_USER = 'newsblur'
DATABASE_PASSWORD = ''
DATABASE_HOST = 'localhost'
DATABASE_PORT = ''
2009-06-16 03:08:55 +00:00
# Absolute path to the directory that holds media.
# Example: "/Users/media/media.lawrence.com/"
MEDIA_URL = 'http://www.newsblur.com/media/'
DEBUG = True
2009-07-25 02:21:12 +00:00
CACHE_BACKEND = 'file:///var/tmp/django_cache'
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(levelname)s %(message)s',
filename=LOG_FILE,
filemode='w')
PREPEND_WWW = True
elif STAGING:
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'newsblur'
DATABASE_USER = 'newsblur'
DATABASE_PASSWORD = ''
DATABASE_HOST = 'localhost'
DATABASE_PORT = ''
2009-06-22 15:28:20 +00:00
# Absolute path to the directory that holds media.
# Example: "/Users/media/media.lawrence.com/"
2009-07-25 02:21:12 +00:00
MEDIA_URL = '/media/'
DEBUG = True
CACHE_BACKEND = 'file:///var/tmp/django_cache'
2009-07-25 02:21:12 +00:00
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(message)s',
filename=LOG_FILE,
filemode='w')
elif DEV_SERVER1:
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'newsblur'
DATABASE_USER = 'newsblur'
DATABASE_PASSWORD = ''
DATABASE_HOST = 'localhost'
DATABASE_PORT = ''
2009-06-16 03:08:55 +00:00
# Absolute path to the directory that holds media.
# Example: "/Users/media/media.lawrence.com/"
MEDIA_URL = '/media/'
DEBUG = True
CACHE_BACKEND = 'dummy:///'
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(message)s',
filename=LOG_FILE,
filemode='w')
elif DEV_SERVER2:
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'newsblur'
DATABASE_USER = 'newsblur'
DATABASE_PASSWORD = ''
DATABASE_HOST = 'localhost'
DATABASE_PORT = ''
# Absolute path to the directory that holds media.
# Example: "/Users/media/media.lawrence.com/"
MEDIA_URL = '/media/'
DEBUG = True
CACHE_BACKEND = 'dummy:///'
# CACHE_BACKEND = 'locmem:///'
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(message)s',
filename=LOG_FILE,
filemode='w')
2009-07-20 05:07:31 +00:00
TEMPLATE_DEBUG = DEBUG
2009-06-16 03:08:55 +00:00
# ===========================
# = Django-specific Modules =
# ===========================
2009-06-16 03:08:55 +00:00
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
'django.template.loaders.eggs.load_template_source',
)
TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.media"
)
MIDDLEWARE_CLASSES = (
'django.middleware.gzip.GZipMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
2009-06-16 03:08:55 +00:00
'django.middleware.common.CommonMiddleware',
'django.middleware.cache.CacheMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
2009-06-16 03:08:55 +00:00
)
2009-09-08 03:15:49 +00:00
# =====================
# = Media Compression =
# =====================
COMPRESS_JS = {
'all': {
'source_filenames': (
'js/jquery-1.3.2.js',
'js/jquery.easing.js',
'js/jquery.newsblur.js',
'js/jquery.scrollTo.js',
'js/jquery.timers.js',
'js/jquery.corners.js',
'js/jquery.hotkeys.js',
'js/jquery.dropshadow.js',
'js/jquery.ajaxupload.js',
'js/jquery.simplemodal-1.3.js',
'js/jquery.color.js',
'js/jquery-ui-1.7.2.custom.min.js',
'js/jquery.layout.js',
'js/newsblur/assetmodel.js',
'js/newsblur/reader.js'
),
2009-09-08 03:43:34 +00:00
'output_filename': 'release/all-compressed-?.js'
2009-09-08 03:15:49 +00:00
}
}
COMPRESS_CSS = {
'all': {
'source_filenames': (
'css/reader.css',
),
2009-09-08 03:43:34 +00:00
'output_filename': 'release/all-compressed-?.css'
2009-09-08 03:15:49 +00:00
}
}
2009-09-08 03:37:17 +00:00
# COMPRESS = True
2009-09-08 03:15:49 +00:00
COMPRESS_AUTO = True
COMPRESS_VERSION = True
COMPRESS_JS_FILTERS = ['compress.filters.jsmin.JSMinFilter']
2009-09-08 03:37:17 +00:00
COMPRESS_CSS_FILTERS = []
# YUI_DIR = ''.join([UTILS_ROOT, '/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar'])
# COMPRESS_YUI_BINARY = 'java -jar ' + YUI_DIR
2009-09-08 03:15:49 +00:00
# COMPRESS_YUI_JS_ARGUMENTS = '--preserve-semi --nomunge --disable-optimizations'
# ========================
# = Django Debug Toolbar =
# ========================
DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.cache.CacheDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel',
)
def custom_show_toolbar(request):
return DEBUG
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': True,
'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
'HIDE_DJANGO_SQL': False,
}
# ==========================
# = Miscellaneous Settings =
# ==========================
2009-06-16 03:08:55 +00:00
AUTH_PROFILE_MODULE = 'newsblur.UserProfile'
TEST_DATABASE_COLLATION = 'utf8_general_ci'
2009-06-16 03:08:55 +00:00
ROOT_URLCONF = 'urls'
INTERNAL_IPS = ('127.0.0.1',)
LOGGING_LOG_SQL = True
APPEND_SLASH = True
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
2009-06-16 03:08:55 +00:00
# ===============
# = Django Apps =
# ===============
2009-06-16 03:08:55 +00:00
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'utils.django_extensions',
2009-09-08 03:15:49 +00:00
'compress',
2009-06-16 03:08:55 +00:00
'apps.rss_feeds',
'apps.reader',
'apps.analyzer',
'apps.registration',
'apps.opml_import',
'apps.profile',
# 'debug_toolbar'
2009-07-25 02:21:12 +00:00
)