# Various methods which interact on the settings. Moved here to make sure they # are executed after the various overrides have happened, like for example # in `91-local.conf`. In general this file shouldn't be touched. # Create the logfile if it doesn't exist if os.path.isdir(LOG_PATH): logging.basicConfig( level = LOG_LEVEL, format = '%(asctime)s %(levelname)s %(message)s', filename = os.path.join(LOG_PATH, 'transifex.log'), filemode = 'a+' ) # Languages # The default language should always be there LANGUAGES.append((LANGUAGE_CODE, LANGUAGE_CODE)) # Remove any duplicated entries and sort LANGUAGES = list(set(LANGUAGES)) LANGUAGES.sort() # If caching is enabled, the necessary middleware needs to be used. # Middleware which needs to be at the beginning: CACHE_MID = {'FIRST': 'django.middleware.cache.UpdateCacheMiddleware', 'LAST': 'django.middleware.cache.FetchFromCacheMiddleware'} if CACHE_BACKEND: if not CACHE_MID['FIRST'] in MIDDLEWARE_CLASSES: MIDDLEWARE_CLASSES.insert(0, CACHE_MID['FIRST']) if not CACHE_MID['LAST'] in MIDDLEWARE_CLASSES: MIDDLEWARE_CLASSES.append(CACHE_MID['LAST']) # Add any debug-only repo prefixes if DEBUG and ALLOWED_REPOSITORY_PREFIXES_DEBUG: ALLOWED_REPOSITORY_PREFIXES['all'].extend(ALLOWED_REPOSITORY_PREFIXES_DEBUG)