import os
import sys

from django.conf import global_settings

abspath = lambda *p: os.path.abspath(os.path.join(*p))

DEBUG = True
TEMPLATE_DEBUG = DEBUG
SECRET_KEY = 'CHANGE_THIS_TO_SOMETHING_UNIQUE_AND_SECURE'

PROJECT_ROOT = abspath(os.path.dirname(__file__))
GUARDIAN_MODULE_PATH = abspath(PROJECT_ROOT, '..')
sys.path.insert(0, GUARDIAN_MODULE_PATH)


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': abspath(PROJECT_ROOT, '.hidden.db'),
    },
    'TEST': {
        'NAME': ':memory:',
    }
}

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'django.contrib.messages',
    'guardian',
    'posts',
    'core',
    'django.contrib.staticfiles',
)

if 'GRAPPELLI' in os.environ:
    try:
        __import__('grappelli')
        INSTALLED_APPS = ('grappelli',) + INSTALLED_APPS
    except ImportError:
        print("django-grappelli not installed")

try:
    import rosetta
    INSTALLED_APPS += ('rosetta',)
except ImportError:
    pass

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)

STATIC_ROOT = abspath(PROJECT_ROOT, '..', 'public', 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = [abspath(PROJECT_ROOT, 'static')]
GUARDIAN_RAISE_403 = True

ROOT_URLCONF = 'urls'

TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + [
    'django.core.context_processors.request',
    'context_processors.version',
    'django.core.context_processors.static',
]
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

TEMPLATE_DIRS = (
    os.path.join(os.path.dirname(__file__), 'templates'),
)

SITE_ID = 1

USE_I18N = True
USE_L10N = True

LOGIN_REDIRECT_URL = '/'

TEST_RUNNER = 'django.test.runner.DiscoverRunner'

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'guardian.backends.ObjectPermissionBackend',
)

ANONYMOUS_USER_ID = -1
GUARDIAN_GET_INIT_ANONYMOUS_USER = 'core.models.get_custom_anon_user'

PASSWORD_HASHERS = (
    'django.contrib.auth.hashers.MD5PasswordHasher',
    'django.contrib.auth.hashers.SHA1PasswordHasher',
)

AUTH_USER_MODEL = 'core.CustomUser'

@@ -19,49 +19,8 @@
 ys%0A%0A
-from django.conf import global_settings%0A%0A
 absp
@@ -1597,61 +1597,49 @@
 S = 
-global_settings.TEMPLATE_CONTEXT_PROCESSORS + %5B
+(%0A    'context_processors.version',
 %0A    
-'
+%22
 djan
@@ -1635,34 +1635,42 @@
 ,%0A    %22django.co
-re
+ntrib.auth
 .context_process
@@ -1677,67 +1677,177 @@
 ors.
-request',%0A    'context_processors.version'
+auth%22,%0A    %22django.template.context_processors.debug%22,%0A    %22django.template.context_processors.i18n%22
 ,%0A    
-'
+%22
 django.
-cor
+template.context_processors.media%22,%0A    %22django.templat
 e.co
@@ -1873,12 +1873,115 @@
 atic
-',%0A%5D
+%22,%0A    %22django.template.context_processors.tz%22,%0A    %22django.contrib.messages.context_processors.messages%22%0A)
 %0ATEM

Fix compatability with Django1.8/1.9