<commit_before>import os

from local_settings import *
from base.permissions import wiki_can_read

# Django settings for roots project.

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

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.FileSystemFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# All-auth requirement
TEMPLATE_CONTEXT_PROCESSORS = (
    "django.core.context_processors.request",
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.core.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    "allauth.account.context_processors.account",
    "allauth.socialaccount.context_processors.socialaccount",
    "sekizai.context_processors.sekizai",
)


# List of callables that know how to import templates from various sources.

if not DEBUG:
    # Enable template caching by default if not debug mode
    TEMPLATE_LOADERS = (
        ('django.template.loaders.cached.Loader', (
            'django.template.loaders.filesystem.Loader',
            'django.template.loaders.app_directories.Loader',
        )),
    )
else:
    TEMPLATE_LOADERS = (
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',
    )


MIDDLEWARE_CLASSES = (
    'django.middleware.gzip.GZipMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'author.middlewares.AuthorDefaultBackendMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'roots.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'roots.wsgi.application'


AUTHENTICATION_BACKENDS = (
    # Needed to login by username in Django admin, regardless of `allauth`
    "django.contrib.auth.backends.ModelBackend",

    # `allauth` specific authentication methods, such as login by e-mail
    "allauth.account.auth_backends.AuthenticationBackend",
)

INSTALLED_APPS = (
    # Roots specific apps
    'base',
    'competitions',
    'downloads',
    'events',
    'leaflets',
    'news',
    'photos',
    'posts',
    'problems',
    'profiles',
    'schools',
    # Grapelli comes first
    'grappelli',
    # Fluent comments come before contrib.comments
    'fluent_comments',
    # Non-roots specific apps
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.comments',
    'django.contrib.flatpages',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    #
    # Social authentication
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    # ... include the providers you want to enable:
    'allauth.socialaccount.providers.facebook',
    'allauth.socialaccount.providers.google',
    # 'allauth.socialaccount.providers.openid',
    # 'allauth.socialaccount.providers.twitter',
    # Support for django-extensions
    'django_extensions',
    # Support database migrations
    'south',
    # Use django-ratings
    'djangoratings',
    # Use django-avatar
    'avatar',
    # Use django-author
    'author',
    # Use django-reversion
    'reversion',
    # Use django-photologue
    'photologue',
    # Use django-debug-toolbar
    'debug_toolbar',
    'debug_toolbar_line_profiler',
    'template_timings_panel',
    # Use django-mathjax
    'django_mathjax',
    # Use crispy-forms
    'crispy_forms',
    # Use django-jquery
    'jquery',
    # Use django-jquery-lightbox
    'jquery_lightbox',
    # Use django-sendfile
    'sendfile',
    # Use django-sortedm2m
    'sortedm2m',
    # Use django-wiki and its requirements
    'django.contrib.humanize',
    'django_notify',
    'mptt',
    'sekizai',
    'sorl.thumbnail',
    'wiki',
    'wiki.plugins.attachments',
    'wiki.plugins.notifications',
    'wiki.plugins.images',
    'wiki.plugins.links',
    'wiki.plugins.help',
    'wiki.plugins.macros',
)

COMMENTS_APP = 'fluent_comments'
FLUENT_COMMENTS_ORDER_REVERSED = True

GRAPPELLI_ADMIN_HEADLINE = 'Roots administration'
GRAPPELLI_ADMIN_TITLE = 'Roots'

AUTHOR_CREATED_BY_FIELD_NAME = 'added_by'
AUTHOR_UPDATED_BY_FIELD_NAME = 'modified_by'

# Remove (None) values from the Admin
from django.contrib.admin.views import main
main.EMPTY_CHANGELIST_VALUE = u''

# Set the message tags as classes in Bootstrap
from django.contrib.messages import constants as message_constants
MESSAGE_TAGS = {
        message_constants.DEBUG: 'alert-info',
        message_constants.INFO: 'alert-info',
        message_constants.SUCCESS: 'alert-success',
        message_constants.WARNING: 'alert-warning',
        message_constants.ERROR: 'alert-danger',
    }

# Require email address at sign up
ACCOUNT_EMAIL_REQUIRED = True
# Make email mandatory part of the registration
ACCOUNT_EMAIL_VERIFICATION = "mandatory"

# Get the projet root
path_parts = os.path.dirname(os.path.realpath(__file__)).split('/')[:-1]
PROJECT_ROOT = '/'.join(path_parts) + '/'
<commit_msg>settings: Use more smarter discovery of PROJECT_ROOT<commit_after>import os

from local_settings import *
from base.permissions import wiki_can_read

# Django settings for roots project.

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

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.FileSystemFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# All-auth requirement
TEMPLATE_CONTEXT_PROCESSORS = (
    "django.core.context_processors.request",
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.core.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    "allauth.account.context_processors.account",
    "allauth.socialaccount.context_processors.socialaccount",
    "sekizai.context_processors.sekizai",
)


# List of callables that know how to import templates from various sources.

if not DEBUG:
    # Enable template caching by default if not debug mode
    TEMPLATE_LOADERS = (
        ('django.template.loaders.cached.Loader', (
            'django.template.loaders.filesystem.Loader',
            'django.template.loaders.app_directories.Loader',
        )),
    )
else:
    TEMPLATE_LOADERS = (
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',
    )


MIDDLEWARE_CLASSES = (
    'django.middleware.gzip.GZipMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'author.middlewares.AuthorDefaultBackendMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'roots.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'roots.wsgi.application'


AUTHENTICATION_BACKENDS = (
    # Needed to login by username in Django admin, regardless of `allauth`
    "django.contrib.auth.backends.ModelBackend",

    # `allauth` specific authentication methods, such as login by e-mail
    "allauth.account.auth_backends.AuthenticationBackend",
)

INSTALLED_APPS = (
    # Roots specific apps
    'base',
    'competitions',
    'downloads',
    'events',
    'leaflets',
    'news',
    'photos',
    'posts',
    'problems',
    'profiles',
    'schools',
    # Grapelli comes first
    'grappelli',
    # Fluent comments come before contrib.comments
    'fluent_comments',
    # Non-roots specific apps
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.comments',
    'django.contrib.flatpages',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    #
    # Social authentication
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    # ... include the providers you want to enable:
    'allauth.socialaccount.providers.facebook',
    'allauth.socialaccount.providers.google',
    # 'allauth.socialaccount.providers.openid',
    # 'allauth.socialaccount.providers.twitter',
    # Support for django-extensions
    'django_extensions',
    # Support database migrations
    'south',
    # Use django-ratings
    'djangoratings',
    # Use django-avatar
    'avatar',
    # Use django-author
    'author',
    # Use django-reversion
    'reversion',
    # Use django-photologue
    'photologue',
    # Use django-debug-toolbar
    'debug_toolbar',
    'debug_toolbar_line_profiler',
    'template_timings_panel',
    # Use django-mathjax
    'django_mathjax',
    # Use crispy-forms
    'crispy_forms',
    # Use django-jquery
    'jquery',
    # Use django-jquery-lightbox
    'jquery_lightbox',
    # Use django-sendfile
    'sendfile',
    # Use django-sortedm2m
    'sortedm2m',
    # Use django-wiki and its requirements
    'django.contrib.humanize',
    'django_notify',
    'mptt',
    'sekizai',
    'sorl.thumbnail',
    'wiki',
    'wiki.plugins.attachments',
    'wiki.plugins.notifications',
    'wiki.plugins.images',
    'wiki.plugins.links',
    'wiki.plugins.help',
    'wiki.plugins.macros',
)

COMMENTS_APP = 'fluent_comments'
FLUENT_COMMENTS_ORDER_REVERSED = True

GRAPPELLI_ADMIN_HEADLINE = 'Roots administration'
GRAPPELLI_ADMIN_TITLE = 'Roots'

AUTHOR_CREATED_BY_FIELD_NAME = 'added_by'
AUTHOR_UPDATED_BY_FIELD_NAME = 'modified_by'

# Remove (None) values from the Admin
from django.contrib.admin.views import main
main.EMPTY_CHANGELIST_VALUE = u''

# Set the message tags as classes in Bootstrap
from django.contrib.messages import constants as message_constants
MESSAGE_TAGS = {
        message_constants.DEBUG: 'alert-info',
        message_constants.INFO: 'alert-info',
        message_constants.SUCCESS: 'alert-success',
        message_constants.WARNING: 'alert-warning',
        message_constants.ERROR: 'alert-danger',
    }

# Require email address at sign up
ACCOUNT_EMAIL_REQUIRED = True
# Make email mandatory part of the registration
ACCOUNT_EMAIL_VERIFICATION = "mandatory"

# Get the projet root
settings_dir = os.path.dirname(os.path.realpath(__file__))
PROJECT_ROOT = os.path.dirname(settings_dir) + '/'

{'fraction_non_alphanumeric': 0.1053910045447422, 'fraction_numerical': 0.0014887948597398528, 'mean_word_length': 3.790915915915916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1500680', 'n_tokens_mistral': 4005, 'n_tokens_neox': 3965, 'n_words': 828}