<commit_before># -*- coding: utf-8 -*-
"""
Django settings for id project.

For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
import os
here = lambda x: os.path.realpath(os.path.join(os.path.realpath(os.path.dirname(__file__)), x))
BASE_DIR = here('../')

try: ID_VERSION = open(".git_current_version").read()
except: ID_VERSION = "?.?.? Unknown: ID Version could not be read: .git_current_version not available"
print "Starting ID version %s" % ID_VERSION

# Allowed hosts:
ALLOWED_HOSTS = []

# https://api.opencorporates.com/documentation/API-Reference#api_accounts
OPENCORPORATES_API_TOKEN = None

# google settings, potentially overridden in settings_local
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '206887598454-nigepmham8557t4uq72dqhgh159p3b1t.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'f6b3cUIp00sDoiRSLfyqAQkH'

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
TEMPLATE_CONTEXT_PROCESSORS += (
    "django.core.context_processors.request",
    "django.contrib.messages.context_processors.messages",
    "django.core.context_processors.csrf",
    "id.context_processors.locale",
    "id.context_processors.routename",
    "search.context_processors.search_types",
    'social.apps.django_app.context_processors.backends',
    'social.apps.django_app.context_processors.login_redirect',
)

# Import local settings or production settings
try:
    if os.environ.get('BUILD_TEST'):
        from settings_build_test import *
    else:
        from settings_local import *

except ImportError:
    raise Exception('You need to set up settings_local.py (see settings_local.py-example')

# Some error checking for local_settings
if not SECRET_KEY:
    raise Exception('You need to specify Django SECRET_KEY in the settings_local.py!')

if "CREDENTIALS_DIR" not in vars():
    raise Exception('You need to specify a path to CREDENTIALS_DIR in settings_local.py')

TEMPLATE_LOADERS = (
    'django_jinja.loaders.FileSystemLoader',
    'django_jinja.loaders.AppLoader',
)


TEMPLATE_DIRS = ('templates',)

# Application definition

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.admin',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'registration',
    'compressor',
    'django_jinja',
    'rest_framework',
    'social.apps.django_app.default',
    'core',
    'id',
    'search',
    'podaci',
    'ticket',
    'projects',
    'django_select2',
    'captcha'
)

DEFAULT_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.get_username',
    'social.pipeline.mail.mail_validation',
    'social.pipeline.social_auth.associate_by_email',
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details'
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'podaci.middleware.PodaciExceptionMiddleware',
)

AUTHENTICATION_BACKENDS = (
    'social.backends.google.GoogleOAuth2',
    'rules.permissions.ObjectPermissionBackend',
    'django.contrib.auth.backends.ModelBackend',
)

# our own precious User model
# as per: https://docs.djangoproject.com/en/dev/topics/auth/customizing/
AUTH_USER_MODEL = 'id.Profile'
# SOCIAL_AUTH_USER_MODEL = 'id.Profile'
# SOCIAL_AUTH_SESSION_EXPIRATION = False # TODO: This shouldn't be done

# registration form class
#from id.forms import ProfileRegistrationForm
#REGISTRATION_FORM=ProfileRegistrationForm
# is the registration alowed?
REGISTRATION_OPEN=True
# set to an URL that a user should be redirected to when registration is disallowed
REGISTRATION_CLOSED_URL="/accounts/register/closed/"
# set to an URL that a user should be redirected upon successful registration
REGISTRATION_SUCCESS_URL="/accounts/register/complete/"

ROOT_URLCONF = 'settings.urls'

AUTO_RENDER_SELECT2_STATICS = False

# FIXME: Move existing templates to .jinja, start writing
#        new templates as .jinja with Django template engine
DEFAULT_JINJA2_TEMPLATE_EXTENSION = '.jinja'

from django_jinja.builtins import DEFAULT_EXTENSIONS<commit_msg>Fix settings to make google auth work<commit_after># -*- coding: utf-8 -*-
"""
Django settings for id project.

For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
import os
here = lambda x: os.path.realpath(os.path.join(os.path.realpath(os.path.dirname(__file__)), x))
BASE_DIR = here('../')

try: ID_VERSION = open(".git_current_version").read()
except: ID_VERSION = "?.?.? Unknown: ID Version could not be read: .git_current_version not available"
print "Starting ID version %s" % ID_VERSION

# Allowed hosts:
ALLOWED_HOSTS = []

# https://api.opencorporates.com/documentation/API-Reference#api_accounts
OPENCORPORATES_API_TOKEN = None

# google settings, potentially overridden in settings_local
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '206887598454-nigepmham8557t4uq72dqhgh159p3b1t.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'f6b3cUIp00sDoiRSLfyqAQkH'
SOCIAL_AUTH_USER_MODEL = 'id.Profile'
SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True
USER_FIELDS = ['email']

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
TEMPLATE_CONTEXT_PROCESSORS += (
    "django.core.context_processors.request",
    "django.contrib.messages.context_processors.messages",
    "django.core.context_processors.csrf",
    "id.context_processors.locale",
    "id.context_processors.routename",
    "search.context_processors.search_types",
    'social.apps.django_app.context_processors.backends',
    'social.apps.django_app.context_processors.login_redirect',
)

# Import local settings or production settings
try:
    if os.environ.get('BUILD_TEST'):
        from settings_build_test import *
    else:
        from settings_local import *

except ImportError:
    raise Exception('You need to set up settings_local.py (see settings_local.py-example')

# Some error checking for local_settings
if not SECRET_KEY:
    raise Exception('You need to specify Django SECRET_KEY in the settings_local.py!')

if "CREDENTIALS_DIR" not in vars():
    raise Exception('You need to specify a path to CREDENTIALS_DIR in settings_local.py')

TEMPLATE_LOADERS = (
    'django_jinja.loaders.FileSystemLoader',
    'django_jinja.loaders.AppLoader',
)


TEMPLATE_DIRS = ('templates',)

# Application definition

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.admin',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'registration',
    'compressor',
    'django_jinja',
    'rest_framework',
    'social.apps.django_app.default',
    'core',
    'id',
    'search',
    'podaci',
    'ticket',
    'projects',
    'django_select2',
    'captcha'
)

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.get_username',
    'social.pipeline.social_auth.associate_by_email',
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details'
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'social.apps.django_app.middleware.SocialAuthExceptionMiddleware',
    'podaci.middleware.PodaciExceptionMiddleware',
)

AUTHENTICATION_BACKENDS = (
    'rules.permissions.ObjectPermissionBackend',
    'django.contrib.auth.backends.ModelBackend',
    'social.backends.google.GoogleOAuth2',
)

if DEBUG:
    SOCIAL_AUTH_RAISE_EXCEPTIONS = True
    RAISE_EXCEPTIONS = True

# our own precious User model
# as per: https://docs.djangoproject.com/en/dev/topics/auth/customizing/
AUTH_USER_MODEL = 'id.Profile'
# SOCIAL_AUTH_USER_MODEL = 'id.Profile'
# SOCIAL_AUTH_SESSION_EXPIRATION = False # TODO: This shouldn't be done

# registration form class
#from id.forms import ProfileRegistrationForm
#REGISTRATION_FORM=ProfileRegistrationForm
# is the registration alowed?
REGISTRATION_OPEN=True
# set to an URL that a user should be redirected to when registration is disallowed
REGISTRATION_CLOSED_URL="/accounts/register/closed/"
# set to an URL that a user should be redirected upon successful registration
REGISTRATION_SUCCESS_URL="/accounts/register/complete/"

ROOT_URLCONF = 'settings.urls'

AUTO_RENDER_SELECT2_STATICS = False

# FIXME: Move existing templates to .jinja, start writing
#        new templates as .jinja with Django template engine
DEFAULT_JINJA2_TEMPLATE_EXTENSION = '.jinja'

from django_jinja.builtins import DEFAULT_EXTENSIONS
{'fraction_non_alphanumeric': 0.10695837131570951, 'fraction_numerical': 0.007900334244910361, 'mean_word_length': 4.923215356928615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '194453', 'n_tokens_mistral': 3290, 'n_tokens_neox': 3238, 'n_words': 591}