# This is your project's main settings file that can be committed to your
# repo. If you need to override a setting locally, use settings_local.py

import os

from funfactory.settings_base import *
import dj_database_url


DATABASES = {'default': dj_database_url.config()}

SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '')
HMAC_KEYS = {'2013-09-24': os.environ.get('DJANGO_HMAC_KEY', '')}
DEBUG = os.environ.get('DJANGO_DEBUG', False)

# Name of the top-level module where you put all your apps.
# If you did not install Playdoh with the funfactory installer script
# you may need to edit this value. See the docs about installing from a
# clone.
PROJECT_MODULE = 'nucleus'

# Defines the views served for root URLs.
ROOT_URLCONF = '%s.urls' % PROJECT_MODULE

INSTALLED_APPS = list(INSTALLED_APPS) + [
    # Application base, containing global templates.
    '%s.base' % PROJECT_MODULE,
    'django.contrib.admin',
    'django_extensions',
    'rest_framework',
    'rest_framework.authtoken',
    'rna',
    'south',
]

# Note! If you intend to add `south` to INSTALLED_APPS,
# make sure it comes BEFORE `django_nose`.
INSTALLED_APPS.remove('django_nose')
INSTALLED_APPS.append('django_nose')


LOCALE_PATHS = (
    os.path.join(ROOT, PROJECT_MODULE, 'locale'),
)

# Because Jinja2 is the default template loader, add any non-Jinja templated
# apps here:
JINGO_EXCLUDE_APPS = [
    'admin',
    'registration',
    'rest_framework',
    'rna',
]

# BrowserID configuration
AUTHENTICATION_BACKENDS = [
    'django_browserid.auth.BrowserIDBackend',
    'django.contrib.auth.backends.ModelBackend',
]

SITE_URL = 'http://127.0.0.1:8000'
LOGIN_URL = '/'
LOGIN_REDIRECT_URL = 'examples.home'
LOGIN_REDIRECT_URL_FAILURE = 'examples.home'

TEMPLATE_CONTEXT_PROCESSORS = list(TEMPLATE_CONTEXT_PROCESSORS) + [
    'django_browserid.context_processors.browserid_form',
]

# Should robots.txt deny everything or disallow a calculated list of URLs we
# don't want to be crawled?  Default is false, disallow everything.
# Also see http://www.google.com/support/webmasters/bin/answer.py?answer=93710
ENGAGE_ROBOTS = False

# Always generate a CSRF token for anonymous users.
ANON_ALWAYS = True

# Tells the extract script what files to look for L10n in and what function
# handles the extraction. The Tower library expects this.
DOMAIN_METHODS['messages'] = [
    ('%s/**.py' % PROJECT_MODULE,
        'tower.management.commands.extract.extract_tower_python'),
    ('%s/**/templates/**.html' % PROJECT_MODULE,
        'tower.management.commands.extract.extract_tower_template'),
    ('templates/**.html',
        'tower.management.commands.extract.extract_tower_template'),
]

# # Use this if you have localizable HTML files:
# DOMAIN_METHODS['lhtml'] = [
#    ('**/templates/**.lhtml',
#        'tower.management.commands.extract.extract_tower_template'),
# ]

# # Use this if you have localizable JS files:
# DOMAIN_METHODS['javascript'] = [
#    # Make sure that this won't pull in strings from external libraries you
#    # may use.
#    ('media/js/**.js', 'javascript'),
# ]

LOGGING = dict(loggers=dict(playdoh = {'level': logging.DEBUG}))

MIDDLEWARE_CLASSES = get_middleware(
    exclude=['funfactory.middleware.LocaleURLMiddleware'])

@@ -3227,8 +3227,597 @@
 ware'%5D)%0A
+%0AREST_FRAMEWORK = %7B%0A    # Use hyperlinked styles by default.%0A    # Only used if the %60serializer_class%60 attribute is not set on a view.%0A    'DEFAULT_MODEL_SERIALIZER_CLASS':%0A        'rest_framework.serializers.HyperlinkedModelSerializer',%0A%0A    # Use Django's standard %60django.contrib.auth%60 permissions,%0A    # or allow read-only access for unauthenticated users.%0A    'DEFAULT_PERMISSION_CLASSES': (%0A        'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',%0A    ),%0A%0A    'DEFAULT_AUTHENTICATION_CLASSES': (%0A        'rest_framework.authentication.TokenAuthentication',%0A    )%0A%7D%0A

Add REST_FRAMEWORK settings