Changes for page Weblate Configuration

Last modified by Simon Urli on 2021/09/17 10:28

<
From version < 4.1 >
edited by Vincent Massol
on 2018/05/08 10:47
To version < 5.1 >
edited by Adel Atallah
on 2018/05/09 09:29
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.VincentMassol
1 +xwiki:XWiki.atallahade
Content
... ... @@ -41,244 +41,19 @@
41 41  
42 42  == Configuration ==
43 43  
44 -Most of the configuration is made by editing the file {{box}}$VIRTUALENV/local/lib/python2.7/site-packages/weblate/settings.py{{/box}}. Here is a sample configuration file:
44 +Most of the configuration is made by editing the file {{box}}$VIRTUALENV/local/lib/python2.7/site-packages/weblate/settings.py{{/box}}. You'll find a sample configuration [[here>>https://docs.weblate.org/en/latest/admin/sample.html#sample-configurationhere]].
45 45  
46 -{{code}}
47 -# -*- coding: utf-8 -*-
48 -#
49 -# Copyright © 2012 - 2018 Michal Čihař <[email protected]>
50 -#
51 -# This file is part of Weblate <https://weblate.org/>
52 -#
53 -# This program is free software: you can redistribute it and/or modify
54 -# it under the terms of the GNU General Public License as published by
55 -# the Free Software Foundation, either version 3 of the License, or
56 -# (at your option) any later version.
57 -#
58 -# This program is distributed in the hope that it will be useful,
59 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
60 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
61 -# GNU General Public License for more details.
62 -#
63 -# You should have received a copy of the GNU General Public License
64 -# along with this program.  If not, see <https://www.gnu.org/licenses/>.
65 -#
46 +Here is what you can add to allow authentication using [[xwiki.org>>http://www.xwiki.org/]] credentials and what you should add to include the required scripts:
66 66  
67 -from __future__ import unicode_literals
68 -import platform
69 -import os
70 -from logging.handlers import SysLogHandler
48 +{{code}}
49 +...
71 71  from social_core.backends.oauth import BaseOAuth2
72 -
73 -#
74 -# Django settings for Weblate project.
75 -#
76 -
77 -DEBUG = False
78 -
79 -ADMINS = (
80 -    # ('Your Name', '[email protected]'),
81 -)
82 -
83 -MANAGERS = ADMINS
84 -
85 -DATABASES = {
86 -    'default': {
87 -        # Use 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
88 -        'ENGINE': 'django.db.backends.postgresql_psycopg2',
89 -        # Database name or path to database file if using sqlite3.
90 -        'NAME': '[DATABASE_NAME]',
91 -        # Database user, not used with sqlite3.
92 -        'USER': '[DATABASE_USERNAME]',
93 -        # Database password, not used with sqlite3.
94 -        'PASSWORD': '[DATABASE_PASSWORD]',
95 -        # Set to empty string for localhost. Not used with sqlite3.
96 -        'HOST': '[DATABASE_HOST]',
97 -        # Set to empty string for default. Not used with sqlite3.
98 -        'PORT': '',
99 -        # Customizations for databases
100 -        'OPTIONS': {
101 -            # Uncomment for MySQL older than 5.7:
102 -            # 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
103 -            # Set emoji capable charset for MySQL:
104 -            # 'charset': 'utf8mb4',
105 -        },
106 -    }
107 -}
108 -
109 -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
110 -
111 -# Data directory
112 -DATA_DIR = os.path.join(BASE_DIR, 'data')
113 -
114 -# Local time zone for this installation. Choices can be found here:
115 -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
116 -# although not all choices may be available on all operating systems.
117 -# In a Windows environment this must be set to your system time zone.
118 -TIME_ZONE = 'UTC'
119 -
120 -# Language code for this installation. All choices can be found here:
121 -# http://www.i18nguy.com/unicode/language-identifiers.html
122 -LANGUAGE_CODE = 'en-us'
123 -
124 -LANGUAGES = (
125 -    ('ar', 'العربية'),
126 -    ('az', 'Azərbaycan'),
127 -    ('be', 'Беларуская'),
128 -    ('be@latin', 'Biełaruskaja'),
129 -    ('bg', 'Български'),
130 -    ('br', 'Brezhoneg'),
131 -    ('ca', 'Català'),
132 -    ('cs', 'Čeština'),
133 -    ('da', 'Dansk'),
134 -    ('de', 'Deutsch'),
135 -    ('en', 'English'),
136 -    ('en-gb', 'English (United Kingdom)'),
137 -    ('el', '&Epsilon;λληνικά'),
138 -    ('es', 'Español'),
139 -    ('fi', 'Suomi'),
140 -    ('fr', 'Français'),
141 -    ('fy', 'Frysk'),
142 -    ('gl', 'Galego'),
143 -    ('he', 'עברית'),
144 -    ('hu', 'Magyar'),
145 -    ('id', 'Indonesia'),
146 -    ('it', 'Italiano'),
147 -    ('ja', '日本語'),
148 -    ('ko', '한국어'),
149 -    ('ksh', 'Kölsch'),
150 -    ('nb', 'Norsk bokmål'),
151 -    ('nl', 'Nederlands'),
152 -    ('pl', 'Polski'),
153 -    ('pt', 'Português'),
154 -    ('pt-br', 'Português brasileiro'),
155 -    ('ru', 'Русский'),
156 -    ('sk', 'Slovenčina'),
157 -    ('sl', 'Slovenščina'),
158 -    ('sr', 'Српски'),
159 -    ('sv', 'Svenska'),
160 -    ('tr', 'Türkçe'),
161 -    ('uk', 'Українська'),
162 -    ('zh-hans', '简体字'),
163 -    ('zh-hant', '正體字'),
164 -)
165 -
166 -SITE_ID = 1
167 -
168 -# If you set this to False, Django will make some optimizations so as not
169 -# to load the internationalization machinery.
170 -USE_I18N = True
171 -
172 -# If you set this to False, Django will not format dates, numbers and
173 -# calendars according to the current locale.
174 -USE_L10N = True
175 -
176 -# If you set this to False, Django will not use timezone-aware datetimes.
177 -USE_TZ = True
178 -
179 -# URL prefix to use, please see documentation for more details
180 -URL_PREFIX = ''
181 -
182 -# Absolute filesystem path to the directory that will hold user-uploaded files.
183 -# Example: "/home/media/media.lawrence.com/media/"
184 -MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
185 -
186 -# URL that handles the media served from MEDIA_ROOT. Make sure to use a
187 -# trailing slash.
188 -# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
189 -MEDIA_URL = '{0}/media/'.format(URL_PREFIX)
190 -
191 -# Absolute path to the directory static files should be collected to.
192 -# Don't put anything in this directory yourself; store your static files
193 -# in apps' "static/" subdirectories and in STATICFILES_DIRS.
194 -# Example: "/home/media/media.lawrence.com/static/"
195 -STATIC_ROOT = os.path.join(DATA_DIR, 'static')
196 -
197 -# URL prefix for static files.
198 -# Example: "http://media.lawrence.com/static/"
199 -STATIC_URL = '{0}/static/'.format(URL_PREFIX)
200 -
201 -# Additional locations of static files
202 -STATICFILES_DIRS = (
203 -    # Put strings here, like "/home/html/static" or "C:/www/django/static".
204 -    # Always use forward slashes, even on Windows.
205 -    # Don't forget to use absolute paths, not relative paths.
206 -)
207 -
208 -# List of finder classes that know how to find static files in
209 -# various locations.
210 -STATICFILES_FINDERS = (
211 -    'django.contrib.staticfiles.finders.FileSystemFinder',
212 -    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
213 -    'compressor.finders.CompressorFinder',
214 -)
215 -
216 -# Make this unique, and don't share it with anybody.
217 -# You can generate it using examples/generate-secret-key
218 -SECRET_KEY = ''
219 -
220 -TEMPLATES = [
221 -    {
222 -        'BACKEND': 'django.template.backends.django.DjangoTemplates',
223 -        'DIRS': [
224 -            os.path.join(BASE_DIR, 'weblate', 'templates'),
225 -        ],
226 -        'OPTIONS': {
227 -            'context_processors': [
228 -                'django.contrib.auth.context_processors.auth',
229 -                'django.template.context_processors.debug',
230 -                'django.template.context_processors.i18n',
231 -                'django.template.context_processors.request',
232 -                'django.template.context_processors.csrf',
233 -                'django.contrib.messages.context_processors.messages',
234 -                'weblate.trans.context_processors.weblate_context',
235 -            ],
236 -            'loaders': [
237 -                ('django.template.loaders.cached.Loader', [
238 -                    'django.template.loaders.filesystem.Loader',
239 -                    'django.template.loaders.app_directories.Loader',
240 -                ]),
241 -            ],
242 -        },
243 -    },
244 -]
245 -
246 -
247 -
248 -# GitHub username for sending pull requests.
249 -# Please see the documentation for more details.
250 -GITHUB_USERNAME = '[GITHUB_USERNAME]'
251 -
252 -# Authentication configuration
51 +...
253 253  AUTHENTICATION_BACKENDS = (
254 -    'social_core.backends.email.EmailAuth',
255 -    # 'social_core.backends.google.GoogleOAuth2',
256 -    'social_core.backends.github.GithubOAuth2',
257 -    # 'social_core.backends.bitbucket.BitbucketOAuth',
258 -    # 'social_core.backends.suse.OpenSUSEOpenId',
259 -    # 'social_core.backends.ubuntu.UbuntuOpenId',
260 -    # 'social_core.backends.fedora.FedoraOpenId',
261 -    # 'social_core.backends.facebook.FacebookOAuth2',
262 -    'weblate.accounts.auth.WeblateUserBackend',
53 +    ...
263 263      'weblate.settings.XWikiOAuth2',
264 264  )
265 265  
266 -# Social auth backends setup
267 -SOCIAL_AUTH_GITHUB_KEY = '[SOCIAL_AUTH_GITHUB_KEY]'
268 -SOCIAL_AUTH_GITHUB_SECRET = '[SOCIAL_AUTH_GITHUB_SECRET]'
269 -SOCIAL_AUTH_GITHUB_SCOPE = ['user:email']
270 -
271 -SOCIAL_AUTH_BITBUCKET_KEY = ''
272 -SOCIAL_AUTH_BITBUCKET_SECRET = ''
273 -SOCIAL_AUTH_BITBUCKET_VERIFIED_EMAILS_ONLY = True
274 -
275 -SOCIAL_AUTH_FACEBOOK_KEY = ''
276 -SOCIAL_AUTH_FACEBOOK_SECRET = ''
277 -SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', 'public_profile']
278 -
279 -SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = ''
280 -SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ''
281 -
282 282  class XWikiOAuth2(BaseOAuth2):
283 283      name = 'XWiki'
284 284      ID_KEY = 'sub'
... ... @@ -309,455 +309,7 @@
309 309          )
310 310  
311 311  SOCIAL_AUTH_XWIKI_KEY = '[SOCIAL_AUTH_XWIKI_KEY]'
312 -
313 -# Social auth settings
314 -SOCIAL_AUTH_PIPELINE = (
315 -    'social_core.pipeline.social_auth.social_details',
316 -    'social_core.pipeline.social_auth.social_uid',
317 -    'social_core.pipeline.social_auth.auth_allowed',
318 -    'social_core.pipeline.social_auth.social_user',
319 -    'weblate.accounts.pipeline.store_params',
320 -    'weblate.accounts.pipeline.verify_open',
321 -    'social_core.pipeline.user.get_username',
322 -    'weblate.accounts.pipeline.require_email',
323 -    'social_core.pipeline.mail.mail_validation',
324 -    'weblate.accounts.pipeline.revoke_mail_code',
325 -    'weblate.accounts.pipeline.ensure_valid',
326 -    'weblate.accounts.pipeline.remove_account',
327 -    'social_core.pipeline.social_auth.associate_by_email',
328 -    'weblate.accounts.pipeline.reauthenticate',
329 -    'weblate.accounts.pipeline.verify_username',
330 -    'social_core.pipeline.user.create_user',
331 -    'social_core.pipeline.social_auth.associate_user',
332 -    'social_core.pipeline.social_auth.load_extra_data',
333 -    'weblate.accounts.pipeline.cleanup_next',
334 -    'weblate.accounts.pipeline.user_full_name',
335 -    'weblate.accounts.pipeline.store_email',
336 -    'weblate.accounts.pipeline.notify_connect',
337 -    'weblate.accounts.pipeline.password_reset',
338 -)
339 -SOCIAL_AUTH_DISCONNECT_PIPELINE = (
340 -    'social_core.pipeline.disconnect.allowed_to_disconnect',
341 -    'social_core.pipeline.disconnect.get_entries',
342 -    'social_core.pipeline.disconnect.revoke_tokens',
343 -    'weblate.accounts.pipeline.cycle_session',
344 -    'weblate.accounts.pipeline.adjust_primary_mail',
345 -    'weblate.accounts.pipeline.notify_disconnect',
346 -    'social_core.pipeline.disconnect.disconnect',
347 -    'weblate.accounts.pipeline.cleanup_next',
348 -)
349 -
350 -# Custom authentication strategy
351 -SOCIAL_AUTH_STRATEGY = 'weblate.accounts.strategy.WeblateStrategy'
352 -
353 -# Raise exceptions so that we can handle them later
354 -SOCIAL_AUTH_RAISE_EXCEPTIONS = True
355 -
356 -SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = \
357 -    'weblate.accounts.pipeline.send_validation'
358 -SOCIAL_AUTH_EMAIL_VALIDATION_URL = \
359 -    '{0}/accounts/email-sent/'.format(URL_PREFIX)
360 -SOCIAL_AUTH_LOGIN_ERROR_URL = \
361 -    '{0}/accounts/login/'.format(URL_PREFIX)
362 -SOCIAL_AUTH_EMAIL_FORM_URL = \
363 -    '{0}/accounts/email/'.format(URL_PREFIX)
364 -SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = \
365 -    '{0}/accounts/profile/#auth'.format(URL_PREFIX)
366 -SOCIAL_AUTH_PROTECTED_USER_FIELDS = ('email',)
367 -SOCIAL_AUTH_SLUGIFY_USERNAMES = True
368 -SOCIAL_AUTH_SLUGIFY_FUNCTION = 'weblate.accounts.pipeline.slugify_username'
369 -
370 -# Password validation configuration
371 -AUTH_PASSWORD_VALIDATORS = [
372 -    {
373 -        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
374 -    },
375 -    {
376 -        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
377 -        'OPTIONS': {
378 -            'min_length': 6,
379 -        }
380 -    },
381 -    {
382 -        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
383 -    },
384 -    {
385 -        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
386 -    },
387 -    {
388 -        'NAME': 'weblate.accounts.password_validation.CharsPasswordValidator',
389 -    },
390 -    {
391 -        'NAME': 'weblate.accounts.password_validation.PastPasswordsValidator',
392 -    },
393 -    # Optional password strength validation by django-zxcvbn-password
394 -    # {
395 -    #     'NAME': 'zxcvbn_password.ZXCVBNValidator',
396 -    #     'OPTIONS': {
397 -    #         'min_score': 3,
398 -    #         'user_attributes': ('username', 'email', 'first_name')
399 -    #     }
400 -    # },
401 -]
402 -
403 -# Middleware
404 -MIDDLEWARE = [
405 -    'django.middleware.security.SecurityMiddleware',
406 -    'django.contrib.sessions.middleware.SessionMiddleware',
407 -    'django.middleware.common.CommonMiddleware',
408 -    'django.middleware.locale.LocaleMiddleware',
409 -    'django.middleware.csrf.CsrfViewMiddleware',
410 -    'weblate.accounts.middleware.AuthenticationMiddleware',
411 -    'django.contrib.messages.middleware.MessageMiddleware',
412 -    'django.middleware.clickjacking.XFrameOptionsMiddleware',
413 -    'social_django.middleware.SocialAuthExceptionMiddleware',
414 -    'weblate.accounts.middleware.RequireLoginMiddleware',
415 -    'weblate.middleware.SecurityMiddleware',
416 -    'weblate.wladmin.middleware.ConfigurationErrorsMiddleware',
417 -]
418 -
419 -ROOT_URLCONF = 'weblate.urls'
420 -
421 -# Django and Weblate apps
422 -INSTALLED_APPS = (
423 -    'django.contrib.auth',
424 -    'django.contrib.contenttypes',
425 -    'django.contrib.sessions',
426 -    'django.contrib.sites',
427 -    'django.contrib.messages',
428 -    'django.contrib.staticfiles',
429 -    'django.contrib.admin.apps.SimpleAdminConfig',
430 -    'django.contrib.admindocs',
431 -    'django.contrib.sitemaps',
432 -    'social_django',
433 -    'crispy_forms',
434 -    'compressor',
435 -    'rest_framework',
436 -    'rest_framework.authtoken',
437 -    'weblate.addons',
438 -    'weblate.trans',
439 -    'weblate.lang',
440 -    'weblate.langdata',
441 -    'weblate.memory',
442 -    'weblate.permissions',
443 -    'weblate.screenshots',
444 -    'weblate.accounts',
445 -    'weblate.utils',
446 -    'weblate.wladmin',
447 -    'weblate',
448 -
449 -    # Optional: Git exporter
450 -    # 'weblate.gitexport',
451 -)
452 -
453 -# Path to locales
454 -LOCALE_PATHS = (os.path.join(BASE_DIR, 'weblate', 'locale'), )
455 -
456 -# Custom exception reporter to include some details
457 -DEFAULT_EXCEPTION_REPORTER_FILTER = \
458 -    'weblate.trans.debug.WeblateExceptionReporterFilter'
459 -
460 -# Default logging of Weblate messages
461 -# - to syslog in production (if available)
462 -# - otherwise to console
463 -# - you can also choose 'logfile' to log into separate file
464 -#   after configuring it below
465 -
466 -# Detect if we can connect to syslog
467 -HAVE_SYSLOG = False
468 -if platform.system() != 'Windows':
469 -    try:
470 -        handler = SysLogHandler(
471 -            address='/dev/log', facility=SysLogHandler.LOG_LOCAL2
472 -        )
473 -        handler.close()
474 -        HAVE_SYSLOG = True
475 -    except IOError:
476 -        HAVE_SYSLOG = False
477 -
478 -if DEBUG or not HAVE_SYSLOG:
479 -    DEFAULT_LOG = 'console'
480 -else:
481 -    DEFAULT_LOG = 'syslog'
482 -
483 -# A sample logging configuration. The only tangible logging
484 -# performed by this configuration is to send an email to
485 -# the site admins on every HTTP 500 error when DEBUG=False.
486 -# See http://docs.djangoproject.com/en/stable/topics/logging for
487 -# more details on how to customize your logging configuration.
488 -LOGGING = {
489 -    'version': 1,
490 -    'disable_existing_loggers': True,
491 -    'filters': {
492 -        'require_debug_false': {
493 -            '()': 'django.utils.log.RequireDebugFalse'
494 -        }
495 -    },
496 -    'formatters': {
497 -        'syslog': {
498 -            'format': 'weblate[%(process)d]: %(levelname)s %(message)s'
499 -        },
500 -        'simple': {
501 -            'format': '%(levelname)s %(message)s'
502 -        },
503 -        'logfile': {
504 -            'format': '%(asctime)s %(levelname)s %(message)s'
505 -        },
506 -        'django.server': {
507 -            '()': 'django.utils.log.ServerFormatter',
508 -            'format': '[%(server_time)s] %(message)s',
509 -        }
510 -    },
511 -    'handlers': {
512 -        'mail_admins': {
513 -            'level': 'ERROR',
514 -            'filters': ['require_debug_false'],
515 -            'class': 'django.utils.log.AdminEmailHandler',
516 -            'include_html': True,
517 -        },
518 -        'console': {
519 -            'level': 'DEBUG',
520 -            'class': 'logging.StreamHandler',
521 -            'formatter': 'simple'
522 -        },
523 -        'django.server': {
524 -            'level': 'INFO',
525 -            'class': 'logging.StreamHandler',
526 -            'formatter': 'django.server',
527 -        },
528 -        'syslog': {
529 -            'level': 'DEBUG',
530 -            'class': 'logging.handlers.SysLogHandler',
531 -            'formatter': 'syslog',
532 -            'address': '/dev/log',
533 -            'facility': SysLogHandler.LOG_LOCAL2,
534 -        },
535 -        # Logging to a file
536 -        # 'logfile': {
537 -        #     'level':'DEBUG',
538 -        #     'class':'logging.handlers.RotatingFileHandler',
539 -        #     'filename': "/var/log/weblate/weblate.log",
540 -        #     'maxBytes': 100000,
541 -        #     'backupCount': 3,
542 -        #     'formatter': 'logfile',
543 -        # },
544 -    },
545 -    'loggers': {
546 -        'django.request': {
547 -            'handlers': ['mail_admins', DEFAULT_LOG],
548 -            'level': 'ERROR',
549 -            'propagate': True,
550 -        },
551 -        'django.server': {
552 -            'handlers': ['django.server'],
553 -            'level': 'INFO',
554 -            'propagate': False,
555 -        },
556 -        # Logging database queries
557 -        # 'django.db.backends': {
558 -        #     'handlers': [DEFAULT_LOG],
559 -        #     'level': 'DEBUG',
560 -        # },
561 -        'weblate': {
562 -            'handlers': [DEFAULT_LOG],
563 -            'level': 'DEBUG',
564 -        },
565 -        # Logging VCS operations
566 -        # 'weblate-vcs': {
567 -        #     'handlers': [DEFAULT_LOG],
568 -        #     'level': 'DEBUG',
569 -        # },
570 -        # Python Social Auth logging
571 -        # 'social': {
572 -        #     'handlers': [DEFAULT_LOG],
573 -        #     'level': 'DEBUG',
574 -        # },
575 -    }
576 -}
577 -
578 -# Logging of management commands to console
579 -if (os.environ.get('DJANGO_IS_MANAGEMENT_COMMAND', False) and
580 -        'console' not in LOGGING['loggers']['weblate']['handlers']):
581 -    LOGGING['loggers']['weblate']['handlers'].append('console')
582 -
583 -# Remove syslog setup if it's not present
584 -if not HAVE_SYSLOG:
585 -    del LOGGING['handlers']['syslog']
586 -
587 -# List of machine translations
588 -# MACHINE_TRANSLATION_SERVICES = (
589 -#     'weblate.trans.machine.apertium.ApertiumAPYTranslation',
590 -#     'weblate.trans.machine.deepl.DeepLTranslation',
591 -#     'weblate.trans.machine.glosbe.GlosbeTranslation',
592 -#     'weblate.trans.machine.google.GoogleTranslation',
593 -#     'weblate.trans.machine.microsoft.MicrosoftCognitiveTranslation',
594 -#     'weblate.trans.machine.mymemory.MyMemoryTranslation',
595 -#     'weblate.trans.machine.tmserver.AmagamaTranslation',
596 -#     'weblate.trans.machine.tmserver.TMServerTranslation',
597 -#     'weblate.trans.machine.yandex.YandexTranslation',
598 -#     'weblate.trans.machine.weblatetm.WeblateTranslation',
599 -#     'weblate.trans.machine.saptranslationhub.SAPTranslationHub',
600 -#     'weblate.memory.machine.WeblateMemory',
601 -# )
602 -
603 -# Machine translation API keys
604 -
605 -# URL of the Apertium APy server
606 -MT_APERTIUM_APY = None
607 -
608 -# DeepL API key
609 -MT_DEEPL_KEY = None
610 -
611 -# Microsoft Cognitive Services Translator API, register at
612 -# https://portal.azure.com/
613 -MT_MICROSOFT_COGNITIVE_KEY = None
614 -
615 -# MyMemory identification email, see
616 -# https://mymemory.translated.net/doc/spec.php
617 -MT_MYMEMORY_EMAIL = None
618 -
619 -# Optional MyMemory credentials to access private translation memory
620 -MT_MYMEMORY_USER = None
621 -MT_MYMEMORY_KEY = None
622 -
623 -# Google API key for Google Translate API
624 -MT_GOOGLE_KEY = None
625 -
626 -# API key for Yandex Translate API
627 -MT_YANDEX_KEY = None
628 -
629 -# tmserver URL
630 -MT_TMSERVER = None
631 -
632 -# SAP Translation Hub
633 -MT_SAP_BASE_URL = None
634 -MT_SAP_SANDBOX_APIKEY = None
635 -MT_SAP_USERNAME = None
636 -MT_SAP_PASSWORD = None
637 -MT_SAP_USE_MT = True
638 -
639 -# Title of site to use
640 -SITE_TITLE = 'Weblate'
641 -
642 -# Whether site uses https
643 -ENABLE_HTTPS = False
644 -
645 -# Use HTTPS when creating redirect URLs for social authentication, see
646 -# documentation for more details:
647 -# http://python-social-auth-docs.readthedocs.io/en/latest/configuration/settings.html#processing-redirects-and-urlopen
648 -SOCIAL_AUTH_REDIRECT_IS_HTTPS = ENABLE_HTTPS
649 -
650 -# Make CSRF cookie HttpOnly, see documentation for more details:
651 -# https://docs.djangoproject.com/en/1.11/ref/settings/#csrf-cookie-httponly
652 -CSRF_COOKIE_HTTPONLY = True
653 -CSRF_COOKIE_SECURE = ENABLE_HTTPS
654 -# Store CSRF token in session (since Django 1.11)
655 -CSRF_USE_SESSIONS = True
656 -SESSION_COOKIE_SECURE = ENABLE_HTTPS
657 -# Session cookie age (in seconds)
658 -SESSION_COOKIE_AGE = 1209600
659 -
660 -# URL of login
661 -LOGIN_URL = '{0}/accounts/login/'.format(URL_PREFIX)
662 -
663 -# URL of logout
664 -LOGOUT_URL = '{0}/accounts/logout/'.format(URL_PREFIX)
665 -
666 -# Default location for login
667 -LOGIN_REDIRECT_URL = '{0}/'.format(URL_PREFIX)
668 -
669 -# Anonymous user name
670 -ANONYMOUS_USER_NAME = 'anonymous'
671 -
672 -# Reverse proxy settings
673 -IP_BEHIND_REVERSE_PROXY = False
674 -IP_PROXY_HEADER = 'HTTP_X_FORWARDED_FOR'
675 -IP_PROXY_OFFSET = 0
676 -
677 -# Sending HTML in mails
678 -EMAIL_SEND_HTML = True
679 -
680 -# Subject of emails includes site title
681 -EMAIL_SUBJECT_PREFIX = '[{0}] '.format(SITE_TITLE)
682 -
683 -# Enable remote hooks
684 -ENABLE_HOOKS = True
685 -
686 -# Whether to run hooks in background
687 -BACKGROUND_HOOKS = True
688 -
689 -# Number of nearby messages to show in each direction
690 -NEARBY_MESSAGES = 5
691 -
692 -# Offload indexing
693 -OFFLOAD_INDEXING = True
694 -
695 -# Use simple language codes for default language/country combinations
696 -SIMPLIFY_LANGUAGES = True
697 -
698 -# Render forms using bootstrap
699 -CRISPY_TEMPLATE_PACK = 'bootstrap3'
700 -
701 -# List of quality checks
702 -# CHECK_LIST = (
703 -#     'weblate.trans.checks.same.SameCheck',
704 -#     'weblate.trans.checks.chars.BeginNewlineCheck',
705 -#     'weblate.trans.checks.chars.EndNewlineCheck',
706 -#     'weblate.trans.checks.chars.BeginSpaceCheck',
707 -#     'weblate.trans.checks.chars.EndSpaceCheck',
708 -#     'weblate.trans.checks.chars.EndStopCheck',
709 -#     'weblate.trans.checks.chars.EndColonCheck',
710 -#     'weblate.trans.checks.chars.EndQuestionCheck',
711 -#     'weblate.trans.checks.chars.EndExclamationCheck',
712 -#     'weblate.trans.checks.chars.EndEllipsisCheck',
713 -#     'weblate.trans.checks.chars.EndSemicolonCheck',
714 -#     'weblate.trans.checks.chars.MaxLengthCheck',
715 -#     'weblate.trans.checks.format.PythonFormatCheck',
716 -#     'weblate.trans.checks.format.PythonBraceFormatCheck',
717 -#     'weblate.trans.checks.format.PHPFormatCheck',
718 -#     'weblate.trans.checks.format.CFormatCheck',
719 -#     'weblate.trans.checks.format.PerlFormatCheck',
720 -#     'weblate.trans.checks.format.JavascriptFormatCheck',
721 -#     'weblate.trans.checks.consistency.PluralsCheck',
722 -#     'weblate.trans.checks.consistency.SamePluralsCheck',
723 -#     'weblate.trans.checks.consistency.ConsistencyCheck',
724 -#     'weblate.trans.checks.consistency.TranslatedCheck',
725 -#     'weblate.trans.checks.chars.NewlineCountingCheck',
726 -#     'weblate.trans.checks.markup.BBCodeCheck',
727 -#     'weblate.trans.checks.chars.ZeroWidthSpaceCheck',
728 -#     'weblate.trans.checks.markup.XMLValidityCheck',
729 -#     'weblate.trans.checks.markup.XMLTagsCheck',
730 -#     'weblate.trans.checks.source.OptionalPluralCheck',
731 -#     'weblate.trans.checks.source.EllipsisCheck',
732 -#     'weblate.trans.checks.source.MultipleFailingCheck',
733 -# )
734 -
735 -# List of automatic fixups
736 -# AUTOFIX_LIST = (
737 -#     'weblate.trans.autofixes.whitespace.SameBookendingWhitespace',
738 -#     'weblate.trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
739 -#     'weblate.trans.autofixes.chars.RemoveZeroSpace',
740 -#     'weblate.trans.autofixes.chars.RemoveControlChars',
741 -# )
742 -
743 -# List of enabled addons
744 -# WEBLATE_ADDONS = (
745 -#     'weblate.addons.gettext.GenerateMoAddon',
746 -#     'weblate.addons.gettext.UpdateLinguasAddon',
747 -#     'weblate.addons.gettext.UpdateConfigureAddon',
748 -#     'weblate.addons.gettext.MsgmergeAddon',
749 -#     'weblate.addons.gettext.GettextCustomizeAddon',
750 -#     'weblate.addons.cleanup.CleanupAddon',
751 -#     'weblate.addons.flags.SourceEditAddon',
752 -#     'weblate.addons.flags.TargetEditAddon',
753 -#     'weblate.addons.json.JSONCustomizeAddon',
754 -#     'weblate.addons.generate.GenerateFileAddon',
755 -#     'weblate.addons.properties.PropertiesSortAddon',
756 -# )
757 -
758 -
759 -
760 -# List of scripts to use in custom processing
87 +...
761 761  POST_UPDATE_SCRIPTS = (
762 762      '[xwiki-dev-tools]/weblate-scripts/post_update.sh',
763 763  )
... ... @@ -770,92 +770,10 @@
770 770  PRE_COMMIT_SCRIPTS = (
771 771      '[xwiki-dev-tools]/xwiki-dev-tools/weblate-scripts/pre_commit.sh',
772 772  )
773 -
774 -# E-mail address that error messages come from.
775 -SERVER_EMAIL = '[email protected]'
776 -
777 -# Default email address to use for various automated correspondence from
778 -# the site managers. Used for registration emails.
779 -DEFAULT_FROM_EMAIL = '[email protected]'
780 -
781 -# List of URLs your site is supposed to serve
782 -ALLOWED_HOSTS = ["weblate.devxwiki.com"]
783 -
784 -# Example configuration to use memcached for caching
785 -CACHES = {
786 -    'default': {
787 -        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
788 -        'LOCATION': '127.0.0.1:11211',
789 -    },
790 -    'avatar': {
791 -        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
792 -        'LOCATION': os.path.join(DATA_DIR, 'avatar-cache'),
793 -        'TIMEOUT': 3600,
794 -        'OPTIONS': {
795 -            'MAX_ENTRIES': 1000,
796 -        },
797 -    }
798 -}
799 -
800 -# REST framework settings for API
801 -REST_FRAMEWORK = {
802 -    # Use Django's standard `django.contrib.auth` permissions,
803 -    # or allow read-only access for unauthenticated users.
804 -    'DEFAULT_PERMISSION_CLASSES': [
805 -        'rest_framework.permissions.IsAuthenticatedOrReadOnly'
806 -    ],
807 -    'DEFAULT_AUTHENTICATION_CLASSES': (
808 -        'rest_framework.authentication.TokenAuthentication',
809 -        'weblate.api.authentication.BearerAuthentication',
810 -        'rest_framework.authentication.SessionAuthentication',
811 -    ),
812 -    'DEFAULT_THROTTLE_CLASSES': (
813 -        'rest_framework.throttling.AnonRateThrottle',
814 -        'rest_framework.throttling.UserRateThrottle'
815 -    ),
816 -    'DEFAULT_THROTTLE_RATES': {
817 -        'anon': '100/day',
818 -        'user': '1000/day'
819 -    },
820 -    'DEFAULT_PAGINATION_CLASS': (
821 -        'rest_framework.pagination.PageNumberPagination'
822 -    ),
823 -    'PAGE_SIZE': 20,
824 -    'VIEW_DESCRIPTION_FUNCTION': 'weblate.api.views.get_view_description',
825 -    'UNAUTHENTICATED_USER': 'weblate.accounts.models.get_anonymous',
826 -}
827 -
828 -# Example for restricting access to logged in users
829 -# LOGIN_REQUIRED_URLS = (
830 -#     r'/(.*)$',
831 -# )
832 -
833 -# In such case you will want to include some of the exceptions
834 -# LOGIN_REQUIRED_URLS_EXCEPTIONS = (
835 -#    r'/accounts/(.*)$', # Required for login
836 -#    r'/static/(.*)$',   # Required for development mode
837 -#    r'/widgets/(.*)$',  # Allowing public access to widgets
838 -#    r'/data/(.*)$',     # Allowing public access to data exports
839 -#    r'/hooks/(.*)$',    # Allowing public access to notification hooks
840 -#    r'/api/(.*)$',      # Allowing access to API
841 -#    r'/js/i18n/$',      # Javascript localization
842 -#    r'/contact/$',      # Optional for contact form
843 -#    r'/legal/(.*)$',    # Optional for legal app
844 -# )
845 -
846 -# Force sane test runner
847 -TEST_RUNNER = 'django.test.runner.DiscoverRunner'
848 848  {{/code}}
849 849  
850 850  You should replace this parameters:
851 851  
852 -* ##[DATABASE_NAME]##
853 -* ##[DATABASE_USERNAME]##
854 -* ##[DATABASE_PASSWORD]##
855 -* ##[DATABASE_HOST]##
856 -* ##[GITHUB_USERNAME]##
857 -* ##[SOCIAL_AUTH_GITHUB_KEY]##
858 -* ##[SOCIAL_AUTH_GITHUB_SECRET]##
859 859  * ##[SOCIAL_AUTH_XWIKI_KEY]##: choose a unique string
860 860  * ##[xwiki-dev-tools]##: local path of [[https:~~/~~/github.com/xwiki/xwiki-dev-tools>>https://github.com/xwiki/xwiki-dev-tools]]
861 861  

Get Connected