Source

byteflow / settings.py

Full commit
# -*- coding: utf-8 -*-

#
# DO NOT EDIT THIS FILE!
#
# If you want to make your own changes, do them in settings_local.py.  All
# variables set in the settings_local.py will override corresponding values from
# settings.py
#

import os.path
import sys

PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))


DEBUG = True

from lib.threadlocals import SiteIDHook

DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = os.path.join(PROJECT_ROOT, 'byteflow.db')

ADMINS = (
    # ('Your Name', 'your_email@domain.com'),
)

MANAGERS = ADMINS

# Defaults -- set these in settings_local.py
TIME_ZONE = 'GMT'
LANGUAGE_CODE = 'en-us'

SITE_ID = SiteIDHook()

# 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/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
MEDIA_URL = '/media/'
STATIC_URL = '/static/'

# 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 = '/admin-media/'

# Don't share it with anybody
if not hasattr(globals(), 'SECRET_KEY'):
    SECRET_FILE = os.path.join(PROJECT_ROOT, 'secret.txt')
    try:
        SECRET_KEY = open(SECRET_FILE).read().strip()
    except IOError:
        try:
            import string, random
            SECRET_KEY = ''.join(random.choice(string.printable) for i in xrange(50))
            secret = file(SECRET_FILE, 'w')
            secret.write(SECRET_KEY)
            secret.close()
        except IOError:
            raise Exception('Please create a %s file with random characters to set your secret key' % SECRET_FILE)

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'lib.template_loaders.get_theme_template',
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
#     'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'middleware.dynamicsite.DynamicSiteMiddleware', # before feedburner
    'middleware.feedburner.FeedburnerMiddleware',
    'lib.threadlocals.ThreadLocalsMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'middleware.url.UrlMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'maintenancemode.middleware.MaintenanceModeMiddleware',
    'middleware.redirect.RedirectMiddleware',
    'openidconsumer.middleware.OpenIDMiddleware',
    'django.middleware.doc.XViewMiddleware',
    'middleware.ajax_errors.AjaxMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
    'pingback.middleware.PingbackMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = [
    "django.core.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.request",
    "context_processors.settings_vars",
]

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'accounts.backends.CommentApprovingBackend',
    'accounts.backends.EmailBackend',
    'openidconsumer.backend.OpenidBackend',
)

ROOT_URLCONF = 'urls'

TEMPLATE_DIRS = (
    os.path.join(PROJECT_ROOT, 'templates'),
)

# Here are included application necessary for work
# All other should go to the ADDITIONAL_APPS
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'django.contrib.sitemaps',
    'django.contrib.flatpages',
    'django.contrib.markup',
    'lib',
    'pytils',
    'accounts',
    'blog',
    'discussion',
    'tagging',
    'typogrify',
    'render',
    'postimage',
    'openidconsumer',
    'openidserver',
    'revcanonical',
)

APPEND_SLASH = False
REMOVE_WWW = True
SITE_PROTOCOL = 'http'
THEME = 'default'

# App settings
PAGINATE_BY = 10
NAME_LENGTH = 256
DATE_FORMAT = "j.m.Y"
TIME_FORMAT = "G:i"
ACTION_RECORD_DAYS = 3
# Set to integer value to close comments after this number of days
COMMENTS_EXPIRE_DAYS = None
# Set to True to disable rel="nofollow" in comments
COMMENTS_FOLLOW = False

# Possible choices are: ''|'simple'|'recaptcha'
# To utilize recaptcha you must get public/private keys
# from http://recaptcha.net/
CAPTCHA=''
RECAPTCHA = {'example.com': {'public': '', 'private': ''}}

# Tagging
FORCE_LOWERCASE_TAGS = True

# OpenID
OPENID_WITH_AUTH = True
OPENID_REDIRECT_NEXT = '/'

# Pingback
PINGBACK_SERVER = {
    'post_detail': 'pingback.getters.post_get',
    }
PINGBACK_RESPONSE_LENGTH = 200

# TODO: move this list to DB
DIRECTORY_URLS = (
    'http://www.google.com/webmasters/tools/ping',
    'http://ping.blogs.yandex.ru/RPC2',
    'http://rpc.technorati.com/rpc/ping',
    )

# Default markup language for you posts. Choices are bbcode, text, html, markdown
RENDER_METHOD = 'markdown'

# Gravatar options
GRAVATAR_ENABLE = False
DEFAULT_AVATAR_IMG = 'avatar.jpg'
DEFAULT_AVATAR_SIZE = 80
DEFAULT_AVATAR_PATH = MEDIA_URL + 'avatars/'

#if "false" robots application would not use auto-generated sitemap.xml
ROBOTS_USE_SITEMAP = True

# Root urlconf component for all blog urls
BLOG_URLCONF_ROOT = 'blog/' # Don't forget that there must be no leading '/'
# Meaningful values:
# - 'blog.views.process_root_request': will redirect to BLOG_URLCONF_ROOT
# - 'blog.views.post_list': will display list of posts
# - 'life.views.life_index': will display list of your life flow,
#    requires enabled 'life' application
URL_ROOT_HANDLER = 'blog.views.process_root_request'

# Some defaults
APPEND_MTIME_TO_STATIC = True # Modification time will be appended in media_css and media_js templatetags
WYSIWYG_ENABLE = False # WYSIWYG for post text in admin
ANONYMOUS_COMMENTS_APPROVED = False # Do anonymous comments become autoapproved?
DEBUG_SQL = False # Show debug information about sql queries at the bottom of page
SHORT_POSTS_IN_FEED = False # Show full post in feed
USE_ATOM = True # Atom is standard, so we're using it by default
FEEDBURNER = {} # Feedburner disabled by default

# Postimage settings
POSTIMAGE_ROOT = MEDIA_ROOT
POSTIMAGE_URL = MEDIA_URL

STATIC_PAGES = (
    # Name, url, title. When bool(name) is False, separator will be inserted
    ('About', '/about/', 'About me'),
    ('Blog', '/%s' % BLOG_URLCONF_ROOT, 'Main place'),
    )

# See all choices in apps/blog/templatetags/bookmarks.py
SOCIAL_BOOKMARKS = ('delicious', 'reddit', 'slashdot', 'digg', 'technorati', 'google')

LOCALE_PATHS = (os.path.join(PROJECT_ROOT, 'locale'), )
THEMES_DIR = os.path.join(PROJECT_ROOT, "themes") # Byteflow themes. Your themes can be out of PROJECT_ROOT.
TEMPLATE_DEBUG = DEBUG
TAGGING_AUTOCOMPLETE_JS_BASE_URL = os.path.join(STATIC_URL, 'js')

# haystack settings
# set False if you have ./manage.py update_index in your cron tasks
HAYSTACK_SEARCH_AUTOUPDATE = True
HAYSTACK_SITECONF = 'apps.search' # don't change it
HAYSTACK_SEARCH_RESULTS_PER_PAGE = 20
HAYSTACK_SEARCH_ENGINE = 'whoosh' # whoosh | solr | xapian | dummy
# see http://haystacksearch.org/docs/tutorial.html#configuration
HAYSTACK_WHOOSH_PATH = os.path.join(PROJECT_ROOT, '.search')
HAYSTACK_XAPIAN_PATH = os.path.join(PROJECT_ROOT, '.search')
HAYSTACK_SOLR_URL = 'http://localhost:8983/solr'

try:
    from settings_local import *
except ImportError:
    import sys
    sys.stderr.write('Unable to read settings_local.py\n')
    # Convenient defaults
    DEBUG = False
    ADDITIONAL_APPS = ('pingback', 'watchlist')

if not hasattr(globals(), 'THEME_STATIC_ROOT'):
   THEME_STATIC_ROOT = os.path.join(STATIC_ROOT, THEME + '/')

if not hasattr(globals(), 'THEME_STATIC_URL'):
   THEME_STATIC_URL = os.path.join(STATIC_URL, THEME + '/')

try:
    INSTALLED_APPS += ADDITIONAL_APPS
except NameError:
    pass

try:
    MIDDLEWARE_CLASSES += ADDITIONAL_MIDDLEWARE
except NameError:
    pass

if DEBUG:
    MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + ('middleware.profile.ProfilerMiddleware', )