Source

byteflow / settings.py

# -*- encoding: utf-8 -*-

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

import os.path
import sys

PROJECT_ROOT = os.path.dirname(__file__)

sys.path.insert(0, os.path.join(PROJECT_ROOT, 'apps'))
sys.path.insert(0, os.path.join(PROJECT_ROOT, 'compat'))

DEBUG = True
TEMPLATE_DEBUG = DEBUG

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

MANAGERS = ADMINS

# Local time zone for this installation. All choices can be found here:
# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
TIME_ZONE = 'Europe/Kiev'

# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = 'en-us'

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/"
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:
            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:
            raise Exception('Please create a %s file with random characters to generate 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',
    'lib.threadlocals.ThreadLocalsMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'middleware.url.UrlMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'middleware.redirect.RedirectMiddleware',
    'openidconsumer.middleware.OpenIDMiddleware',
    'django.middleware.doc.XViewMiddleware',
    'middleware.ajax_errors.AjaxMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

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'),
)

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',
    'openidconsumer',
    'pingback',
    'tagging',
    'typogrify',
    'render',
    'robots',
    'textblocks',
    'livejournal',
    'blogroll',
    'openidserver',
)

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

# Tagging
FORCE_LOWERCASE_TAGS = True

# OpenID
OPENID_WITH_AUTH = True
OPENID_REDIRECT_NEXT = '/'

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

PINGBACK_CLIENT = {
    'blog.post': {'content': 'html', 'url': 'get_absolute_url'},
    }

# Blogs directory ping
ENABLE_DIRECTORY_PING = False
# TODO: move this list to DB
DIRECTORY_URLS = (
    '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
URL_PREFIX = '' # default URL_PREFIX
BLOG_URLCONF_ROOT = 'blog/' # Don't forget that there must be no leading '/'

# 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?
CAPTCHA_ENABLED = ANONYMOUS_COMMENTS_APPROVED # Enable captcha?
DEBUG_SQL = False # Show debug information about sql queries at the bottom of page
ENABLE_IMPORT = False # Enable importers
ENABLE_LJ_CROSSPOST = False # Disable by defauls
SHORT_POSTS_IN_FEED = False # Show full post in feed
ENABLE_SAPE = False # Disable 'sape.ru' client

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

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

try:
    from settings_local import *
except ImportError:
    import sys
    sys.stderr.write('Unable to read settings_local.py\n')
    sys.exit(1)

if ENABLE_IMPORT:
    INSTALLED_APPS += ('wpimport', )

if ENABLE_SAPE:
    INSTALLED_APPS += ('sape', )

if hasattr(globals(), 'ADDITIONAL_APPS'):
    INSTALLED_APPS = INSTALLED_APPS + getattr('ADDITIONAL_APPS', globals())

LOCALE_PATHS = [os.path.join(PROJECT_ROOT, 'locale')]
THEME_STATIC_URL = os.path.join(STATIC_URL, THEME + '/')