1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

Update settings.py for 2.20

This commit is contained in:
Jean-Baptiste Holcroft 2018-04-07 10:59:06 +02:00
parent 995275545b
commit 20281a7830

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright © 2012 - 2017 Michal Čihař <michal@cihar.com> # Copyright © 2012 - 2018 Michal Čihař <michal@cihar.com>
# #
# This file is part of Weblate <https://weblate.org/> # This file is part of Weblate <https://weblate.org/>
# #
@ -68,6 +68,7 @@ TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
LANGUAGES = ( LANGUAGES = (
('ar', 'العربية'),
('az', 'Azərbaycan'), ('az', 'Azərbaycan'),
('be', 'Беларуская'), ('be', 'Беларуская'),
('be@latin', 'Biełaruskaja'), ('be@latin', 'Biełaruskaja'),
@ -166,7 +167,7 @@ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [ 'DIRS': [
os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'weblate', 'templates'),
], ],
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
@ -325,6 +326,7 @@ MIDDLEWARE = [
'social_django.middleware.SocialAuthExceptionMiddleware', 'social_django.middleware.SocialAuthExceptionMiddleware',
'weblate.accounts.middleware.RequireLoginMiddleware', 'weblate.accounts.middleware.RequireLoginMiddleware',
'weblate.middleware.SecurityMiddleware', 'weblate.middleware.SecurityMiddleware',
'weblate.wladmin.middleware.ConfigurationErrorsMiddleware',
] ]
ROOT_URLCONF = 'weblate.urls' ROOT_URLCONF = 'weblate.urls'
@ -345,8 +347,11 @@ INSTALLED_APPS = (
'compressor', 'compressor',
'rest_framework', 'rest_framework',
'rest_framework.authtoken', 'rest_framework.authtoken',
'weblate.addons',
'weblate.trans', 'weblate.trans',
'weblate.lang', 'weblate.lang',
'weblate.langdata',
'weblate.memory',
'weblate.permissions', 'weblate.permissions',
'weblate.screenshots', 'weblate.screenshots',
'weblate.accounts', 'weblate.accounts',
@ -395,7 +400,7 @@ else:
# more details on how to customize your logging configuration. # more details on how to customize your logging configuration.
LOGGING = { LOGGING = {
'version': 1, 'version': 1,
'disable_existing_loggers': False, 'disable_existing_loggers': True,
'filters': { 'filters': {
'require_debug_false': { 'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse' '()': 'django.utils.log.RequireDebugFalse'
@ -411,6 +416,10 @@ LOGGING = {
'logfile': { 'logfile': {
'format': '%(asctime)s %(levelname)s %(message)s' 'format': '%(asctime)s %(levelname)s %(message)s'
}, },
'django.server': {
'()': 'django.utils.log.ServerFormatter',
'format': '[%(server_time)s] %(message)s',
}
}, },
'handlers': { 'handlers': {
'mail_admins': { 'mail_admins': {
@ -424,6 +433,11 @@ LOGGING = {
'class': 'logging.StreamHandler', 'class': 'logging.StreamHandler',
'formatter': 'simple' 'formatter': 'simple'
}, },
'django.server': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'django.server',
},
'syslog': { 'syslog': {
'level': 'DEBUG', 'level': 'DEBUG',
'class': 'logging.handlers.SysLogHandler', 'class': 'logging.handlers.SysLogHandler',
@ -447,6 +461,11 @@ LOGGING = {
'level': 'ERROR', 'level': 'ERROR',
'propagate': True, 'propagate': True,
}, },
'django.server': {
'handlers': ['django.server'],
'level': 'INFO',
'propagate': False,
},
# Logging database queries # Logging database queries
# 'django.db.backends': { # 'django.db.backends': {
# 'handlers': [DEFAULT_LOG], # 'handlers': [DEFAULT_LOG],
@ -481,6 +500,7 @@ if not HAVE_SYSLOG:
# List of machine translations # List of machine translations
# MACHINE_TRANSLATION_SERVICES = ( # MACHINE_TRANSLATION_SERVICES = (
# 'weblate.trans.machine.apertium.ApertiumAPYTranslation', # 'weblate.trans.machine.apertium.ApertiumAPYTranslation',
# 'weblate.trans.machine.deepl.DeepLTranslation',
# 'weblate.trans.machine.glosbe.GlosbeTranslation', # 'weblate.trans.machine.glosbe.GlosbeTranslation',
# 'weblate.trans.machine.google.GoogleTranslation', # 'weblate.trans.machine.google.GoogleTranslation',
# 'weblate.trans.machine.microsoft.MicrosoftCognitiveTranslation', # 'weblate.trans.machine.microsoft.MicrosoftCognitiveTranslation',
@ -488,8 +508,9 @@ if not HAVE_SYSLOG:
# 'weblate.trans.machine.tmserver.AmagamaTranslation', # 'weblate.trans.machine.tmserver.AmagamaTranslation',
# 'weblate.trans.machine.tmserver.TMServerTranslation', # 'weblate.trans.machine.tmserver.TMServerTranslation',
# 'weblate.trans.machine.yandex.YandexTranslation', # 'weblate.trans.machine.yandex.YandexTranslation',
# 'weblate.trans.machine.weblatetm.WeblateSimilarTranslation',
# 'weblate.trans.machine.weblatetm.WeblateTranslation', # 'weblate.trans.machine.weblatetm.WeblateTranslation',
# 'weblate.trans.machine.saptranslationhub.SAPTranslationHub',
# 'weblate.memory.machine.WeblateMemory',
# ) # )
# Machine translation API keys # Machine translation API keys
@ -497,10 +518,8 @@ if not HAVE_SYSLOG:
# URL of the Apertium APy server # URL of the Apertium APy server
MT_APERTIUM_APY = None MT_APERTIUM_APY = None
# Microsoft Translator service, register at # DeepL API key
# https://datamarket.azure.com/developer/applications/ MT_DEEPL_KEY = None
MT_MICROSOFT_ID = None
MT_MICROSOFT_SECRET = None
# Microsoft Cognitive Services Translator API, register at # Microsoft Cognitive Services Translator API, register at
# https://portal.azure.com/ # https://portal.azure.com/
@ -523,6 +542,13 @@ MT_YANDEX_KEY = None
# tmserver URL # tmserver URL
MT_TMSERVER = None MT_TMSERVER = None
# SAP Translation Hub
MT_SAP_BASE_URL = None
MT_SAP_SANDBOX_APIKEY = None
MT_SAP_USERNAME = None
MT_SAP_PASSWORD = None
MT_SAP_USE_MT = True
# Title of site to use # Title of site to use
SITE_TITLE = 'Weblate' SITE_TITLE = 'Weblate'
@ -576,9 +602,6 @@ BACKGROUND_HOOKS = True
# Number of nearby messages to show in each direction # Number of nearby messages to show in each direction
NEARBY_MESSAGES = 5 NEARBY_MESSAGES = 5
# Enable lazy commits
LAZY_COMMITS = True
# Offload indexing # Offload indexing
OFFLOAD_INDEXING = True OFFLOAD_INDEXING = True
@ -630,6 +653,22 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3'
# 'weblate.trans.autofixes.chars.RemoveControlChars', # 'weblate.trans.autofixes.chars.RemoveControlChars',
# ) # )
# List of enabled addons
# WEBLATE_ADDONS = (
# 'weblate.addons.gettext.GenerateMoAddon',
# 'weblate.addons.gettext.UpdateLinguasAddon',
# 'weblate.addons.gettext.UpdateConfigureAddon',
# 'weblate.addons.gettext.MsgmergeAddon',
# 'weblate.addons.gettext.GettextCustomizeAddon',
# 'weblate.addons.cleanup.CleanupAddon',
# 'weblate.addons.flags.SourceEditAddon',
# 'weblate.addons.flags.TargetEditAddon',
# 'weblate.addons.json.JSONCustomizeAddon',
# 'weblate.addons.generate.GenerateFileAddon',
# 'weblate.addons.properties.PropertiesSortAddon',
# )
# List of scripts to use in custom processing # List of scripts to use in custom processing
# POST_UPDATE_SCRIPTS = ( # POST_UPDATE_SCRIPTS = (
# ) # )
@ -671,6 +710,7 @@ REST_FRAMEWORK = {
], ],
'DEFAULT_AUTHENTICATION_CLASSES': ( 'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication', 'rest_framework.authentication.TokenAuthentication',
'weblate.api.authentication.BearerAuthentication',
'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.SessionAuthentication',
), ),
'DEFAULT_THROTTLE_CLASSES': ( 'DEFAULT_THROTTLE_CLASSES': (
@ -702,7 +742,11 @@ REST_FRAMEWORK = {
# r'/data/(.*)$', # Allowing public access to data exports # r'/data/(.*)$', # Allowing public access to data exports
# r'/hooks/(.*)$', # Allowing public access to notification hooks # r'/hooks/(.*)$', # Allowing public access to notification hooks
# r'/api/(.*)$', # Allowing access to API # r'/api/(.*)$', # Allowing access to API
# r'/js/i18n/$', # Javascript localization
# r'/contact/$', # Optional for contact form
# r'/legal/(.*)$', # Optional for legal app
# ) # )
# Force sane test runner # Force sane test runner
TEST_RUNNER = 'django.test.runner.DiscoverRunner' TEST_RUNNER = 'django.test.runner.DiscoverRunner'