<commit_before># coding: utf-8

import os
import sys
from dext.utils.meta_config import MetaConfig

TESTS_RUNNING = 'test' in sys.argv or 'testserver' in sys.argv

PROJECT_DIR = os.path.dirname(__file__)

META_CONFIG_FILE = os.path.join(PROJECT_DIR, 'meta_config.json')
meta_config = MetaConfig(config_path=META_CONFIG_FILE)

#TODO: calculate how many times this module has imported
sys.path.append(os.path.join(PROJECT_DIR, '../'))

DEBUG = False

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'riddles',
        'USER': 'riddles',
        'PASSWORD': '<PASSWORD>',
        'HOST': '',
        'PORT': '',
    }
}

TIME_ZONE = 'UTC'

LANGUAGE_CODE = 'ru'

SITE_ID = 1
SITE_URL = 'zagadki.org'

X_FRAME_OPTIONS = 'DENY'

##############################
# I18N
##############################

USE_I18N = True
USE_L10N = True

##############################
# static content settings
##############################

STATIC_URL = '/static/%s/' % meta_config.static_data_version
STATIC_DIR = os.path.join(PROJECT_DIR, 'static')

ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'

DCONT_URL = '/dcont/'
DCONT_DIR = os.path.join(PROJECT_DIR, 'dcont')

LESS_CSS_URL = STATIC_URL + 'less/'
LESS_FILES_DIR = os.path.join(PROJECT_DIR, 'less')
LESS_DEST_DIR = os.path.join(PROJECT_DIR, 'static', 'css')

SECRET_KEY = '<KEY>'

GA_CODE = 'UA-10915391-1'

################################
# Mail settings
################################

EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'

################################
# Other settings
################################

APPEND_SLASH = True

#TODO: jinja
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    '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.contrib.messages.context_processors.messages',
    'dext.less.context_processors.less',
    'utils.context_processors.categories'
    )

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',
)

ROOT_URLCONF = 'urls'

TEMPLATE_DIRS = (
    os.path.join(PROJECT_DIR, 'templates'),
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.admin',

    'utils',

    'portal',

    'riddles',

    'south',

    'dext.less'
)

try:
    from settings_local import *
except:
    pass

if 'TEMPLATE_DEBUG' not in globals():
    TEMPLATE_DEBUG = DEBUG

if not DEBUG:
    LESS_CSS_URL = '%scss/' % STATIC_URL

############################
# LOGGING
############################

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'verbose': {
            'format': '[%(levelname)s %(asctime)s %(module)s %(process)d] %(message)s'
        },
        'simple': {
            'format': '[%(levelname)s] %(message)s'
        },
    },
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse',
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
            },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
            }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    } if not TESTS_RUNNING else {}
}<commit_msg>gh-26 включить кэширование<commit_after># coding: utf-8

import os
import sys
from dext.utils.meta_config import MetaConfig

TESTS_RUNNING = 'test' in sys.argv or 'testserver' in sys.argv

PROJECT_DIR = os.path.dirname(__file__)

META_CONFIG_FILE = os.path.join(PROJECT_DIR, 'meta_config.json')
meta_config = MetaConfig(config_path=META_CONFIG_FILE)

#TODO: calculate how many times this module has imported
sys.path.append(os.path.join(PROJECT_DIR, '../'))

DEBUG = False

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'riddles',
        'USER': 'riddles',
        'PASSWORD': 'riddles',
        'HOST': '',
        'PORT': '',
    }
}

TIME_ZONE = 'UTC'

LANGUAGE_CODE = 'ru'

SITE_ID = 1
SITE_URL = 'zagadki.org'

X_FRAME_OPTIONS = 'DENY'

##############################
# I18N
##############################

USE_I18N = True
USE_L10N = True

##############################
# static content settings
##############################

STATIC_URL = '/static/%s/' % meta_config.static_data_version
STATIC_DIR = os.path.join(PROJECT_DIR, 'static')

ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'

DCONT_URL = '/dcont/'
DCONT_DIR = os.path.join(PROJECT_DIR, 'dcont')

LESS_CSS_URL = STATIC_URL + 'less/'
LESS_FILES_DIR = os.path.join(PROJECT_DIR, 'less')
LESS_DEST_DIR = os.path.join(PROJECT_DIR, 'static', 'css')

SECRET_KEY = '<KEY>'

GA_CODE = 'UA-10915391-1'

################################
# Mail settings
################################

EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'

################################
# Other settings
################################

APPEND_SLASH = True

#TODO: jinja
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    '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.contrib.messages.context_processors.messages',
    'dext.less.context_processors.less',
    'utils.context_processors.categories'
    )

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

ROOT_URLCONF = 'urls'

TEMPLATE_DIRS = (
    os.path.join(PROJECT_DIR, 'templates'),
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.admin',

    'utils',

    'portal',

    'riddles',

    'south',

    'dext.less'
)

try:
    from settings_local import *
except:
    pass

if 'TEMPLATE_DEBUG' not in globals():
    TEMPLATE_DEBUG = DEBUG

if not DEBUG:
    LESS_CSS_URL = '%scss/' % STATIC_URL

############################
# LOGGING
############################

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'verbose': {
            'format': '[%(levelname)s %(asctime)s %(module)s %(process)d] %(message)s'
        },
        'simple': {
            'format': '[%(levelname)s] %(message)s'
        },
    },
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse',
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
            },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
            }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    } if not TESTS_RUNNING else {}
}


################
# CACHING
################

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
        'LOCATION': '127.0.0.1:11211',
    }
}
CACHE_MIDDLEWARE_SECONDS = 24*60*60
CACHE_MIDDLEWARE_KEY_PREFIX = ''
{'fraction_non_alphanumeric': 0.21035409606170385, 'fraction_numerical': 0.007128666588757742, 'mean_word_length': 3.406797116374871, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '5913099', 'n_tokens_mistral': 2964, 'n_tokens_neox': 2894, 'n_words': 430}