Source

Mango / settings / __init__.py

Full commit
import sys
import os

from django.utils.encoding import smart_unicode

dirname = os.path.dirname(__file__)

execfile(os.path.join(dirname, 'defaults.py'))
try:
    execfile(os.path.join(dirname, 'custom.py'))
except IOError:
    pass

if BASE_URL is None:
    sys.stderr.write('You must set `BASE_URL` in mango/settings/custom.py.\n')
    sys.exit(1)

BASE_URL = smart_unicode('%s/' % BASE_URL.rstrip('/'))

BODY_WIDTH = 78

DISPLAY_DATE_FORMAT = smart_unicode(DISPLAY_DATE_FORMAT)
DISPLAY_TIME_FORMAT = smart_unicode(DISPLAY_TIME_FORMAT)

MARKDOWN_DATE_FORMAT = u'%d %B %Y'  # e.g. 2 April 2010
MARKDOWN_TIME_FORMAT = u'%I:%M%p'  # e.g. 6:50pm

DISQUS = bool(DISQUS_API_KEY)

DOCUMENTS_PATH = os.path.expanduser(smart_unicode(DOCUMENTS_PATH.rstrip('/')))
PATH_TO_STATIC = os.path.expanduser(smart_unicode(PATH_TO_STATIC.rstrip('/')))

if PRIMARY_AUTHOR_NAME:
    PRIMARY_AUTHOR_NAME = smart_unicode(PRIMARY_AUTHOR_NAME.strip())
if PRIMARY_AUTHOR_EMAIL:
    PRIMARY_AUTHOR_EMAIL = smart_unicode(PRIMARY_AUTHOR_EMAIL.strip().lower())
if PRIMARY_AUTHOR_URL:
    PRIMARY_AUTHOR_URL = smart_unicode(PRIMARY_AUTHOR_URL.strip())

if SHORT_URL_BASE:
    SHORT_URL_BASE = smart_unicode('%s/' % SHORT_URL_BASE.rstrip('/'))

SITE_TITLE = smart_unicode(SITE_TITLE)

TAGS_PAGE = 'tags' in META_LISTS

MANGO_PATH = os.path.dirname(dirname)

PROJECT_PATH = os.path.dirname(MANGO_PATH)

if not os.path.isabs(DOCUMENTS_PATH):
    DOCUMENTS_PATH = os.path.join(PROJECT_PATH, *DOCUMENTS_PATH.split(u'/'))

REPO_URL = u'https://bitbucket.org/davidchambers/mango'

SOURCE_SUFFIX = u'm/'

def _unix_documents_path():
    fragments = []
    head, tail = os.path.split(DOCUMENTS_PATH)
    while tail:
        fragments.insert(0, tail)
        head, tail = os.path.split(head)
    return u'/%s' % '/'.join(fragments)

UNIX_DOCUMENTS_PATH = _unix_documents_path()

_baking = False

del dirname, os, smart_unicode  # tidy the namespace