mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Upgrade to 3.1.1
Upgrade to 3.1.1
This commit is contained in:
commit
c827809443
11 changed files with 2435 additions and 198 deletions
10
README.md
10
README.md
|
@ -8,6 +8,16 @@ The YunoHost team uses [Weblate](https://weblate.org) for translations: https://
|
||||||
|
|
||||||
An admin user is created at installation, the login is what you provided at installation, the password is **weblate**.
|
An admin user is created at installation, the login is what you provided at installation, the password is **weblate**.
|
||||||
|
|
||||||
|
## Weblate 3.0 upgrade
|
||||||
|
|
||||||
|
This upgrade is a major one, remember to read this page before upgrading: https://docs.weblate.org/en/latest/admin/upgrade.html#upgrade-3
|
||||||
|
|
||||||
|
After upgrading:
|
||||||
|
|
||||||
|
* All existing users and groups have been migrated to new model.
|
||||||
|
* Any per user permissions are removed, please assign users to appropriate groups and roles to grant them permissions.
|
||||||
|
* Any custom groups will not have any permissions after upgrade, please grant the permissions again.
|
||||||
|
|
||||||
## Github
|
## Github
|
||||||
|
|
||||||
You'll need to give weblate a github user and a token. Please read [github's documentation about token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
|
You'll need to give weblate a github user and a token. Please read [github's documentation about token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
|
||||||
|
|
|
@ -19,8 +19,7 @@
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
# latest published in community.json
|
upgrade=1 from_commit=f2c1f14df484d727f1918821b6ade3887f77ec40
|
||||||
upgrade=1 from_commit=dc037965b0fbc1bd59d352c4d2b71a97b1e4768f
|
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
|
@ -43,6 +42,6 @@
|
||||||
Email=jean-baptiste@holcroft.fr
|
Email=jean-baptiste@holcroft.fr
|
||||||
Notification=all
|
Notification=all
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=dc037965b0fbc1bd59d352c4d2b71a97b1e4768f
|
; commit=f2c1f14df484d727f1918821b6ade3887f77ec40
|
||||||
name=Upgrade from 2.17.1
|
name=Upgrade from 2.20
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&github_account=fake&github_token=fake
|
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&github_account=fake&github_token=fake
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# https://docs.weblate.org/en/latest/admin/install.html#production-cron
|
# https://docs.weblate.org/en/latest/admin/install.html#production-cron
|
||||||
# Fulltext index updates
|
# Fulltext index updates
|
||||||
*/5 * * * * weblate DJANGO_SETTINGS_MODULE="weblate.settings" __FINALPATH__/venv/bin/weblate update_index
|
*/5 * * * * __APP__ export DJANGO_SETTINGS_MODULE="weblate.settings" && cd __FINALPATH__ && venv/bin/weblate update_index
|
||||||
|
|
||||||
# Cleanup stale objects
|
# Cleanup stale objects
|
||||||
@daily weblate DJANGO_SETTINGS_MODULE="weblate.settings" __FINALPATH__/venv/bin/weblate cleanuptrans
|
@daily __APP__ export DJANGO_SETTINGS_MODULE="weblate.settings" && cd __FINALPATH__ && venv/bin/weblate cleanuptrans
|
||||||
|
|
||||||
# Commit pending changes after 96 hours
|
# Commit pending changes after 96 hours
|
||||||
@hourly weblate DJANGO_SETTINGS_MODULE="weblate.settings" __FINALPATH__/venv/bin/weblate commit_pending --all --age=96 --verbosity=0
|
@hourly __APP__ export DJANGO_SETTINGS_MODULE="weblate.settings" && cd __FINALPATH__ && venv/bin/weblate commit_pending --all --age=96 --verbosity=0
|
||||||
|
|
757
conf/settings_history/settings.3.0.1.py
Normal file
757
conf/settings_history/settings.3.0.1.py
Normal file
|
@ -0,0 +1,757 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright © 2012 - 2018 Michal Čihař <michal@cihar.com>
|
||||||
|
#
|
||||||
|
# This file is part of Weblate <https://weblate.org/>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import platform
|
||||||
|
import os
|
||||||
|
from logging.handlers import SysLogHandler
|
||||||
|
|
||||||
|
#
|
||||||
|
# Django settings for Weblate project.
|
||||||
|
#
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
|
||||||
|
ADMINS = (
|
||||||
|
('__ADMIN__', '__ADMINMAIL__'),
|
||||||
|
)
|
||||||
|
|
||||||
|
MANAGERS = ADMINS
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
# Database engine
|
||||||
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
# Database name
|
||||||
|
'NAME': '__NAME__',
|
||||||
|
# Database user
|
||||||
|
'USER': '__NAME__',
|
||||||
|
# Database password
|
||||||
|
'PASSWORD': '__DB_PWD__',
|
||||||
|
# Set to empty string for localhost
|
||||||
|
'HOST': 'localhost',
|
||||||
|
# Set to empty string for default
|
||||||
|
'PORT': '5432',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR = '__FINALPATH__'
|
||||||
|
|
||||||
|
# Data directory
|
||||||
|
DATA_DIR = os.path.join(BASE_DIR, 'data')
|
||||||
|
|
||||||
|
# Local time zone for this installation. Choices can be found here:
|
||||||
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||||
|
# although not all choices may be available on all operating systems.
|
||||||
|
# In a Windows environment this must be set to your system time zone.
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
# Language code for this installation. All choices can be found here:
|
||||||
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
LANGUAGES = (
|
||||||
|
('ar', 'العربية'),
|
||||||
|
('az', 'Azərbaycan'),
|
||||||
|
('be', 'Беларуская'),
|
||||||
|
('be@latin', 'Biełaruskaja'),
|
||||||
|
('bg', 'Български'),
|
||||||
|
('br', 'Brezhoneg'),
|
||||||
|
('ca', 'Català'),
|
||||||
|
('cs', 'Čeština'),
|
||||||
|
('da', 'Dansk'),
|
||||||
|
('de', 'Deutsch'),
|
||||||
|
('en', 'English'),
|
||||||
|
('en-gb', 'English (United Kingdom)'),
|
||||||
|
('el', 'Ελληνικά'),
|
||||||
|
('es', 'Español'),
|
||||||
|
('fi', 'Suomi'),
|
||||||
|
('fr', 'Français'),
|
||||||
|
('fy', 'Frysk'),
|
||||||
|
('gl', 'Galego'),
|
||||||
|
('he', 'עברית'),
|
||||||
|
('hu', 'Magyar'),
|
||||||
|
('id', 'Indonesia'),
|
||||||
|
('it', 'Italiano'),
|
||||||
|
('ja', '日本語'),
|
||||||
|
('ko', '한국어'),
|
||||||
|
('ksh', 'Kölsch'),
|
||||||
|
('nb', 'Norsk bokmål'),
|
||||||
|
('nl', 'Nederlands'),
|
||||||
|
('pl', 'Polski'),
|
||||||
|
('pt', 'Português'),
|
||||||
|
('pt-br', 'Português brasileiro'),
|
||||||
|
('ru', 'Русский'),
|
||||||
|
('sk', 'Slovenčina'),
|
||||||
|
('sl', 'Slovenščina'),
|
||||||
|
('sr', 'Српски'),
|
||||||
|
('sv', 'Svenska'),
|
||||||
|
('tr', 'Türkçe'),
|
||||||
|
('uk', 'Українська'),
|
||||||
|
('zh-hans', '简体字'),
|
||||||
|
('zh-hant', '正體字'),
|
||||||
|
)
|
||||||
|
|
||||||
|
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 to use, please see documentation for more details
|
||||||
|
URL_PREFIX = '__PATHURL__'
|
||||||
|
|
||||||
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||||
|
# Example: "/home/media/media.lawrence.com/media/"
|
||||||
|
MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
|
||||||
|
|
||||||
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||||
|
# trailing slash.
|
||||||
|
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
||||||
|
MEDIA_URL = '{0}/media/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Absolute path to the directory static files should be collected to.
|
||||||
|
# Don't put anything in this directory yourself; store your static files
|
||||||
|
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||||
|
# Example: "/home/media/media.lawrence.com/static/"
|
||||||
|
STATIC_ROOT = os.path.join(DATA_DIR, 'static')
|
||||||
|
|
||||||
|
# URL prefix for static files.
|
||||||
|
# Example: "http://media.lawrence.com/static/"
|
||||||
|
STATIC_URL = '{0}/static/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Additional locations of static files
|
||||||
|
STATICFILES_DIRS = (
|
||||||
|
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||||
|
# Always use forward slashes, even on Windows.
|
||||||
|
# Don't forget to use absolute paths, not relative paths.
|
||||||
|
)
|
||||||
|
|
||||||
|
# List of finder classes that know how to find static files in
|
||||||
|
# various locations.
|
||||||
|
STATICFILES_FINDERS = (
|
||||||
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||||
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||||
|
'compressor.finders.CompressorFinder',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make this unique, and don't share it with anybody.
|
||||||
|
# You can generate it using examples/generate-secret-key
|
||||||
|
SECRET_KEY = '__KEY__' # noqa
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [
|
||||||
|
os.path.join(BASE_DIR, 'weblate', 'templates'),
|
||||||
|
],
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.i18n',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.template.context_processors.csrf',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
'weblate.trans.context_processors.weblate_context',
|
||||||
|
],
|
||||||
|
'loaders': [
|
||||||
|
('django.template.loaders.cached.Loader', [
|
||||||
|
'django.template.loaders.filesystem.Loader',
|
||||||
|
'django.template.loaders.app_directories.Loader',
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# GitHub username for sending pull requests.
|
||||||
|
# Please see the documentation for more details.
|
||||||
|
GITHUB_USERNAME = "__GITHUBUSER__"
|
||||||
|
|
||||||
|
# Authentication configuration
|
||||||
|
AUTHENTICATION_BACKENDS = (
|
||||||
|
'social_core.backends.email.EmailAuth',
|
||||||
|
# 'social_core.backends.google.GoogleOAuth2',
|
||||||
|
# 'social_core.backends.github.GithubOAuth2',
|
||||||
|
# 'social_core.backends.bitbucket.BitbucketOAuth',
|
||||||
|
'social_core.backends.suse.OpenSUSEOpenId',
|
||||||
|
'social_core.backends.ubuntu.UbuntuOpenId',
|
||||||
|
'social_core.backends.fedora.FedoraOpenId',
|
||||||
|
# 'social_core.backends.facebook.FacebookOAuth2',
|
||||||
|
'weblate.accounts.auth.WeblateUserBackend',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Custom user model
|
||||||
|
AUTH_USER_MODEL = 'weblate_auth.User'
|
||||||
|
|
||||||
|
# Social auth backends setup
|
||||||
|
SOCIAL_AUTH_GITHUB_KEY = ''
|
||||||
|
SOCIAL_AUTH_GITHUB_SECRET = ''
|
||||||
|
SOCIAL_AUTH_GITHUB_SCOPE = ['user:email']
|
||||||
|
|
||||||
|
SOCIAL_AUTH_BITBUCKET_KEY = ''
|
||||||
|
SOCIAL_AUTH_BITBUCKET_SECRET = ''
|
||||||
|
SOCIAL_AUTH_BITBUCKET_VERIFIED_EMAILS_ONLY = True
|
||||||
|
|
||||||
|
SOCIAL_AUTH_FACEBOOK_KEY = ''
|
||||||
|
SOCIAL_AUTH_FACEBOOK_SECRET = ''
|
||||||
|
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', 'public_profile']
|
||||||
|
|
||||||
|
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = ''
|
||||||
|
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ''
|
||||||
|
|
||||||
|
# Social auth settings
|
||||||
|
SOCIAL_AUTH_PIPELINE = (
|
||||||
|
'social_core.pipeline.social_auth.social_details',
|
||||||
|
'social_core.pipeline.social_auth.social_uid',
|
||||||
|
'social_core.pipeline.social_auth.auth_allowed',
|
||||||
|
'social_core.pipeline.social_auth.social_user',
|
||||||
|
'weblate.accounts.pipeline.store_params',
|
||||||
|
'weblate.accounts.pipeline.verify_open',
|
||||||
|
'social_core.pipeline.user.get_username',
|
||||||
|
'weblate.accounts.pipeline.require_email',
|
||||||
|
'social_core.pipeline.mail.mail_validation',
|
||||||
|
'weblate.accounts.pipeline.revoke_mail_code',
|
||||||
|
'weblate.accounts.pipeline.ensure_valid',
|
||||||
|
'weblate.accounts.pipeline.remove_account',
|
||||||
|
'social_core.pipeline.social_auth.associate_by_email',
|
||||||
|
'weblate.accounts.pipeline.reauthenticate',
|
||||||
|
'weblate.accounts.pipeline.verify_username',
|
||||||
|
'social_core.pipeline.user.create_user',
|
||||||
|
'social_core.pipeline.social_auth.associate_user',
|
||||||
|
'social_core.pipeline.social_auth.load_extra_data',
|
||||||
|
'weblate.accounts.pipeline.cleanup_next',
|
||||||
|
'weblate.accounts.pipeline.user_full_name',
|
||||||
|
'weblate.accounts.pipeline.store_email',
|
||||||
|
'weblate.accounts.pipeline.notify_connect',
|
||||||
|
'weblate.accounts.pipeline.password_reset',
|
||||||
|
)
|
||||||
|
SOCIAL_AUTH_DISCONNECT_PIPELINE = (
|
||||||
|
'social_core.pipeline.disconnect.allowed_to_disconnect',
|
||||||
|
'social_core.pipeline.disconnect.get_entries',
|
||||||
|
'social_core.pipeline.disconnect.revoke_tokens',
|
||||||
|
'weblate.accounts.pipeline.cycle_session',
|
||||||
|
'weblate.accounts.pipeline.adjust_primary_mail',
|
||||||
|
'weblate.accounts.pipeline.notify_disconnect',
|
||||||
|
'social_core.pipeline.disconnect.disconnect',
|
||||||
|
'weblate.accounts.pipeline.cleanup_next',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Custom authentication strategy
|
||||||
|
SOCIAL_AUTH_STRATEGY = 'weblate.accounts.strategy.WeblateStrategy'
|
||||||
|
|
||||||
|
# Raise exceptions so that we can handle them later
|
||||||
|
SOCIAL_AUTH_RAISE_EXCEPTIONS = True
|
||||||
|
|
||||||
|
SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = \
|
||||||
|
'weblate.accounts.pipeline.send_validation'
|
||||||
|
SOCIAL_AUTH_EMAIL_VALIDATION_URL = \
|
||||||
|
'{0}/accounts/email-sent/'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_LOGIN_ERROR_URL = \
|
||||||
|
'{0}/accounts/login/'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_EMAIL_FORM_URL = \
|
||||||
|
'{0}/accounts/email/'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = \
|
||||||
|
'{0}/accounts/profile/#auth'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ('email',)
|
||||||
|
SOCIAL_AUTH_SLUGIFY_USERNAMES = True
|
||||||
|
SOCIAL_AUTH_SLUGIFY_FUNCTION = 'weblate.accounts.pipeline.slugify_username'
|
||||||
|
|
||||||
|
# Password validation configuration
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
'OPTIONS': {
|
||||||
|
'min_length': 6,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'weblate.accounts.password_validation.CharsPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'weblate.accounts.password_validation.PastPasswordsValidator',
|
||||||
|
},
|
||||||
|
# Optional password strength validation by django-zxcvbn-password
|
||||||
|
# {
|
||||||
|
# 'NAME': 'zxcvbn_password.ZXCVBNValidator',
|
||||||
|
# 'OPTIONS': {
|
||||||
|
# 'min_score': 3,
|
||||||
|
# 'user_attributes': ('username', 'email', 'full_name')
|
||||||
|
# }
|
||||||
|
# },
|
||||||
|
]
|
||||||
|
|
||||||
|
# Middleware
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'weblate.accounts.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
'social_django.middleware.SocialAuthExceptionMiddleware',
|
||||||
|
'weblate.accounts.middleware.RequireLoginMiddleware',
|
||||||
|
'weblate.middleware.SecurityMiddleware',
|
||||||
|
'weblate.wladmin.middleware.ConfigurationErrorsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'weblate.urls'
|
||||||
|
|
||||||
|
# Django and Weblate apps
|
||||||
|
INSTALLED_APPS = (
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.sites',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'django.contrib.admin.apps.SimpleAdminConfig',
|
||||||
|
'django.contrib.admindocs',
|
||||||
|
'django.contrib.sitemaps',
|
||||||
|
'social_django',
|
||||||
|
'crispy_forms',
|
||||||
|
'compressor',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework.authtoken',
|
||||||
|
'weblate.addons',
|
||||||
|
'weblate.auth',
|
||||||
|
'weblate.checks',
|
||||||
|
'weblate.formats',
|
||||||
|
'weblate.machinery',
|
||||||
|
'weblate.trans',
|
||||||
|
'weblate.lang',
|
||||||
|
'weblate.langdata',
|
||||||
|
'weblate.memory',
|
||||||
|
'weblate.permissions',
|
||||||
|
'weblate.screenshots',
|
||||||
|
'weblate.accounts',
|
||||||
|
'weblate.utils',
|
||||||
|
'weblate.vcs',
|
||||||
|
'weblate.wladmin',
|
||||||
|
'weblate',
|
||||||
|
|
||||||
|
# Optional: Git exporter
|
||||||
|
# 'weblate.gitexport',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Path to locales
|
||||||
|
LOCALE_PATHS = (os.path.join(BASE_DIR, 'weblate', 'locale'), )
|
||||||
|
|
||||||
|
# Custom exception reporter to include some details
|
||||||
|
DEFAULT_EXCEPTION_REPORTER_FILTER = \
|
||||||
|
'weblate.trans.debug.WeblateExceptionReporterFilter'
|
||||||
|
|
||||||
|
# Default logging of Weblate messages
|
||||||
|
# - to syslog in production (if available)
|
||||||
|
# - otherwise to console
|
||||||
|
# - you can also choose 'logfile' to log into separate file
|
||||||
|
# after configuring it below
|
||||||
|
|
||||||
|
# Detect if we can connect to syslog
|
||||||
|
HAVE_SYSLOG = False
|
||||||
|
if platform.system() != 'Windows':
|
||||||
|
try:
|
||||||
|
handler = SysLogHandler(
|
||||||
|
address='/dev/log', facility=SysLogHandler.LOG_LOCAL2
|
||||||
|
)
|
||||||
|
handler.close()
|
||||||
|
HAVE_SYSLOG = True
|
||||||
|
except IOError:
|
||||||
|
HAVE_SYSLOG = False
|
||||||
|
|
||||||
|
if DEBUG or not HAVE_SYSLOG:
|
||||||
|
DEFAULT_LOG = 'console'
|
||||||
|
else:
|
||||||
|
DEFAULT_LOG = 'syslog'
|
||||||
|
|
||||||
|
# A sample logging configuration. The only tangible logging
|
||||||
|
# performed by this configuration is to send an email to
|
||||||
|
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||||
|
# See http://docs.djangoproject.com/en/stable/topics/logging for
|
||||||
|
# more details on how to customize your logging configuration.
|
||||||
|
LOGGING = {
|
||||||
|
'version': 1,
|
||||||
|
'disable_existing_loggers': True,
|
||||||
|
'filters': {
|
||||||
|
'require_debug_false': {
|
||||||
|
'()': 'django.utils.log.RequireDebugFalse'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'formatters': {
|
||||||
|
'syslog': {
|
||||||
|
'format': 'weblate[%(process)d]: %(levelname)s %(message)s'
|
||||||
|
},
|
||||||
|
'simple': {
|
||||||
|
'format': '%(levelname)s %(message)s'
|
||||||
|
},
|
||||||
|
'logfile': {
|
||||||
|
'format': '%(asctime)s %(levelname)s %(message)s'
|
||||||
|
},
|
||||||
|
'django.server': {
|
||||||
|
'()': 'django.utils.log.ServerFormatter',
|
||||||
|
'format': '[%(server_time)s] %(message)s',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'handlers': {
|
||||||
|
'mail_admins': {
|
||||||
|
'level': 'ERROR',
|
||||||
|
'filters': ['require_debug_false'],
|
||||||
|
'class': 'django.utils.log.AdminEmailHandler',
|
||||||
|
'include_html': True,
|
||||||
|
},
|
||||||
|
'console': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'formatter': 'simple'
|
||||||
|
},
|
||||||
|
'django.server': {
|
||||||
|
'level': 'INFO',
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'formatter': 'django.server',
|
||||||
|
},
|
||||||
|
'syslog': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'class': 'logging.handlers.SysLogHandler',
|
||||||
|
'formatter': 'syslog',
|
||||||
|
'address': '/dev/log',
|
||||||
|
'facility': SysLogHandler.LOG_LOCAL2,
|
||||||
|
},
|
||||||
|
# Logging to a file
|
||||||
|
# 'logfile': {
|
||||||
|
# 'level':'DEBUG',
|
||||||
|
# 'class':'logging.handlers.RotatingFileHandler',
|
||||||
|
# 'filename': "/var/log/weblate/weblate.log",
|
||||||
|
# 'maxBytes': 100000,
|
||||||
|
# 'backupCount': 3,
|
||||||
|
# 'formatter': 'logfile',
|
||||||
|
# },
|
||||||
|
},
|
||||||
|
'loggers': {
|
||||||
|
'django.request': {
|
||||||
|
'handlers': ['mail_admins', DEFAULT_LOG],
|
||||||
|
'level': 'ERROR',
|
||||||
|
'propagate': True,
|
||||||
|
},
|
||||||
|
'django.server': {
|
||||||
|
'handlers': ['django.server'],
|
||||||
|
'level': 'INFO',
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
# Logging database queries
|
||||||
|
# 'django.db.backends': {
|
||||||
|
# 'handlers': [DEFAULT_LOG],
|
||||||
|
# 'level': 'DEBUG',
|
||||||
|
# },
|
||||||
|
'weblate': {
|
||||||
|
'handlers': [DEFAULT_LOG],
|
||||||
|
'level': 'DEBUG',
|
||||||
|
},
|
||||||
|
# Logging VCS operations
|
||||||
|
# 'weblate-vcs': {
|
||||||
|
# 'handlers': [DEFAULT_LOG],
|
||||||
|
# 'level': 'DEBUG',
|
||||||
|
# },
|
||||||
|
# Python Social Auth logging
|
||||||
|
# 'social': {
|
||||||
|
# 'handlers': [DEFAULT_LOG],
|
||||||
|
# 'level': 'DEBUG',
|
||||||
|
# },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Logging of management commands to console
|
||||||
|
if (os.environ.get('DJANGO_IS_MANAGEMENT_COMMAND', False) and
|
||||||
|
'console' not in LOGGING['loggers']['weblate']['handlers']):
|
||||||
|
LOGGING['loggers']['weblate']['handlers'].append('console')
|
||||||
|
|
||||||
|
# Remove syslog setup if it's not present
|
||||||
|
if not HAVE_SYSLOG:
|
||||||
|
del LOGGING['handlers']['syslog']
|
||||||
|
|
||||||
|
# List of machine translations
|
||||||
|
# MT_SERVICES = (
|
||||||
|
# 'weblate.machinery.apertium.ApertiumAPYTranslation',
|
||||||
|
# 'weblate.machinery.deepl.DeepLTranslation',
|
||||||
|
# 'weblate.machinery.glosbe.GlosbeTranslation',
|
||||||
|
# 'weblate.machinery.google.GoogleTranslation',
|
||||||
|
# 'weblate.machinery.microsoft.MicrosoftCognitiveTranslation',
|
||||||
|
# 'weblate.machinery.mymemory.MyMemoryTranslation',
|
||||||
|
# 'weblate.machinery.tmserver.AmagamaTranslation',
|
||||||
|
# 'weblate.machinery.tmserver.TMServerTranslation',
|
||||||
|
# 'weblate.machinery.yandex.YandexTranslation',
|
||||||
|
# 'weblate.machinery.weblatetm.WeblateTranslation',
|
||||||
|
# 'weblate.machinery.saptranslationhub.SAPTranslationHub',
|
||||||
|
# 'weblate.memory.machine.WeblateMemory',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# Machine translation API keys
|
||||||
|
|
||||||
|
# URL of the Apertium APy server
|
||||||
|
MT_APERTIUM_APY = None
|
||||||
|
|
||||||
|
# DeepL API key
|
||||||
|
MT_DEEPL_KEY = None
|
||||||
|
|
||||||
|
# Microsoft Cognitive Services Translator API, register at
|
||||||
|
# https://portal.azure.com/
|
||||||
|
MT_MICROSOFT_COGNITIVE_KEY = None
|
||||||
|
|
||||||
|
# MyMemory identification email, see
|
||||||
|
# https://mymemory.translated.net/doc/spec.php
|
||||||
|
MT_MYMEMORY_EMAIL = None
|
||||||
|
|
||||||
|
# Optional MyMemory credentials to access private translation memory
|
||||||
|
MT_MYMEMORY_USER = None
|
||||||
|
MT_MYMEMORY_KEY = None
|
||||||
|
|
||||||
|
# Google API key for Google Translate API
|
||||||
|
MT_GOOGLE_KEY = None
|
||||||
|
|
||||||
|
# API key for Yandex Translate API
|
||||||
|
MT_YANDEX_KEY = None
|
||||||
|
|
||||||
|
# tmserver URL
|
||||||
|
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
|
||||||
|
SITE_TITLE = 'Weblate'
|
||||||
|
|
||||||
|
# Whether site uses https
|
||||||
|
ENABLE_HTTPS = True
|
||||||
|
|
||||||
|
# Use HTTPS when creating redirect URLs for social authentication, see
|
||||||
|
# documentation for more details:
|
||||||
|
# http://python-social-auth-docs.readthedocs.io/en/latest/configuration/settings.html#processing-redirects-and-urlopen
|
||||||
|
SOCIAL_AUTH_REDIRECT_IS_HTTPS = ENABLE_HTTPS
|
||||||
|
|
||||||
|
# Make CSRF cookie HttpOnly, see documentation for more details:
|
||||||
|
# https://docs.djangoproject.com/en/1.11/ref/settings/#csrf-cookie-httponly
|
||||||
|
CSRF_COOKIE_HTTPONLY = True
|
||||||
|
CSRF_COOKIE_SECURE = ENABLE_HTTPS
|
||||||
|
# Store CSRF token in session (since Django 1.11)
|
||||||
|
CSRF_USE_SESSIONS = True
|
||||||
|
SESSION_COOKIE_SECURE = ENABLE_HTTPS
|
||||||
|
# Session cookie age (in seconds)
|
||||||
|
SESSION_COOKIE_AGE = 1209600
|
||||||
|
|
||||||
|
# URL of login
|
||||||
|
LOGIN_URL = '{0}/accounts/login/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# URL of logout
|
||||||
|
LOGOUT_URL = '{0}/accounts/logout/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Default location for login
|
||||||
|
LOGIN_REDIRECT_URL = '{0}/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Anonymous user name
|
||||||
|
ANONYMOUS_USER_NAME = 'anonymous'
|
||||||
|
|
||||||
|
# Reverse proxy settings
|
||||||
|
IP_BEHIND_REVERSE_PROXY = False
|
||||||
|
IP_PROXY_HEADER = 'HTTP_X_FORWARDED_FOR'
|
||||||
|
IP_PROXY_OFFSET = 0
|
||||||
|
|
||||||
|
# Sending HTML in mails
|
||||||
|
EMAIL_SEND_HTML = True
|
||||||
|
|
||||||
|
# Subject of emails includes site title
|
||||||
|
EMAIL_SUBJECT_PREFIX = '[{0}] '.format(SITE_TITLE)
|
||||||
|
|
||||||
|
EMAIL_BACKEND = 'django_sendmail_backend.backends.EmailBackend'
|
||||||
|
|
||||||
|
# Enable remote hooks
|
||||||
|
ENABLE_HOOKS = True
|
||||||
|
|
||||||
|
# Whether to run hooks in background
|
||||||
|
BACKGROUND_HOOKS = True
|
||||||
|
|
||||||
|
# Number of nearby messages to show in each direction
|
||||||
|
NEARBY_MESSAGES = 5
|
||||||
|
|
||||||
|
# Offload indexing
|
||||||
|
OFFLOAD_INDEXING = True
|
||||||
|
|
||||||
|
# Use simple language codes for default language/country combinations
|
||||||
|
SIMPLIFY_LANGUAGES = True
|
||||||
|
|
||||||
|
# Render forms using bootstrap
|
||||||
|
CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
||||||
|
|
||||||
|
# List of quality checks
|
||||||
|
# CHECK_LIST = (
|
||||||
|
# 'weblate.checks.same.SameCheck',
|
||||||
|
# 'weblate.checks.chars.BeginNewlineCheck',
|
||||||
|
# 'weblate.checks.chars.EndNewlineCheck',
|
||||||
|
# 'weblate.checks.chars.BeginSpaceCheck',
|
||||||
|
# 'weblate.checks.chars.EndSpaceCheck',
|
||||||
|
# 'weblate.checks.chars.EndStopCheck',
|
||||||
|
# 'weblate.checks.chars.EndColonCheck',
|
||||||
|
# 'weblate.checks.chars.EndQuestionCheck',
|
||||||
|
# 'weblate.checks.chars.EndExclamationCheck',
|
||||||
|
# 'weblate.checks.chars.EndEllipsisCheck',
|
||||||
|
# 'weblate.checks.chars.EndSemicolonCheck',
|
||||||
|
# 'weblate.checks.chars.MaxLengthCheck',
|
||||||
|
# 'weblate.checks.format.PythonFormatCheck',
|
||||||
|
# 'weblate.checks.format.PythonBraceFormatCheck',
|
||||||
|
# 'weblate.checks.format.PHPFormatCheck',
|
||||||
|
# 'weblate.checks.format.CFormatCheck',
|
||||||
|
# 'weblate.checks.format.PerlFormatCheck',
|
||||||
|
# 'weblate.checks.format.JavascriptFormatCheck',
|
||||||
|
# 'weblate.checks.consistency.PluralsCheck',
|
||||||
|
# 'weblate.checks.consistency.SamePluralsCheck',
|
||||||
|
# 'weblate.checks.consistency.ConsistencyCheck',
|
||||||
|
# 'weblate.checks.consistency.TranslatedCheck',
|
||||||
|
# 'weblate.checks.chars.NewlineCountingCheck',
|
||||||
|
# 'weblate.checks.markup.BBCodeCheck',
|
||||||
|
# 'weblate.checks.chars.ZeroWidthSpaceCheck',
|
||||||
|
# 'weblate.checks.markup.XMLValidityCheck',
|
||||||
|
# 'weblate.checks.markup.XMLTagsCheck',
|
||||||
|
# 'weblate.checks.source.OptionalPluralCheck',
|
||||||
|
# 'weblate.checks.source.EllipsisCheck',
|
||||||
|
# 'weblate.checks.source.MultipleFailingCheck',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# List of automatic fixups
|
||||||
|
# AUTOFIX_LIST = (
|
||||||
|
# 'weblate.trans.autofixes.whitespace.SameBookendingWhitespace',
|
||||||
|
# 'weblate.trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
|
||||||
|
# 'weblate.trans.autofixes.chars.RemoveZeroSpace',
|
||||||
|
# '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.gettext.GettextAuthorComments',
|
||||||
|
# 'weblate.addons.cleanup.CleanupAddon',
|
||||||
|
# 'weblate.addons.consistency.LangaugeConsistencyAddon',
|
||||||
|
# 'weblate.addons.discovery.DiscoveryAddon',
|
||||||
|
# 'weblate.addons.flags.SourceEditAddon',
|
||||||
|
# 'weblate.addons.flags.TargetEditAddon',
|
||||||
|
# 'weblate.addons.generate.GenerateFileAddon',
|
||||||
|
# 'weblate.addons.json.JSONCustomizeAddon',
|
||||||
|
# 'weblate.addons.properties.PropertiesSortAddon',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# E-mail address that error messages come from.
|
||||||
|
SERVER_EMAIL = 'noreply@__DOMAIN__'
|
||||||
|
|
||||||
|
# Default email address to use for various automated correspondence from
|
||||||
|
# the site managers. Used for registration emails.
|
||||||
|
DEFAULT_FROM_EMAIL = '__ADMINMAIL__'
|
||||||
|
|
||||||
|
# List of URLs your site is supposed to serve
|
||||||
|
ALLOWED_HOSTS = ['__DOMAIN__']
|
||||||
|
|
||||||
|
# Example configuration to use memcached for caching
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||||
|
'LOCATION': '127.0.0.1:__MEMCPORT__',
|
||||||
|
},
|
||||||
|
'avatar': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
|
||||||
|
'LOCATION': os.path.join(BASE_DIR, 'avatar-cache'),
|
||||||
|
'TIMEOUT': 3600,
|
||||||
|
'OPTIONS': {
|
||||||
|
'MAX_ENTRIES': 1000,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# REST framework settings for API
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
# Use Django's standard `django.contrib.auth` permissions,
|
||||||
|
# or allow read-only access for unauthenticated users.
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': [
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly'
|
||||||
|
],
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework.authentication.TokenAuthentication',
|
||||||
|
'weblate.api.authentication.BearerAuthentication',
|
||||||
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_THROTTLE_CLASSES': (
|
||||||
|
'rest_framework.throttling.AnonRateThrottle',
|
||||||
|
'rest_framework.throttling.UserRateThrottle'
|
||||||
|
),
|
||||||
|
'DEFAULT_THROTTLE_RATES': {
|
||||||
|
'anon': '100/day',
|
||||||
|
'user': '1000/day'
|
||||||
|
},
|
||||||
|
'DEFAULT_PAGINATION_CLASS': (
|
||||||
|
'rest_framework.pagination.PageNumberPagination'
|
||||||
|
),
|
||||||
|
'PAGE_SIZE': 20,
|
||||||
|
'VIEW_DESCRIPTION_FUNCTION': 'weblate.api.views.get_view_description',
|
||||||
|
'UNAUTHENTICATED_USER': 'weblate.auth.models.get_anonymous',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Example for restricting access to logged in users
|
||||||
|
# LOGIN_REQUIRED_URLS = (
|
||||||
|
# r'/(.*)$',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# In such case you will want to include some of the exceptions
|
||||||
|
# LOGIN_REQUIRED_URLS_EXCEPTIONS = (
|
||||||
|
# r'/accounts/(.*)$', # Required for login
|
||||||
|
# r'/static/(.*)$', # Required for development mode
|
||||||
|
# r'/widgets/(.*)$', # Allowing public access to widgets
|
||||||
|
# r'/data/(.*)$', # Allowing public access to data exports
|
||||||
|
# r'/hooks/(.*)$', # Allowing public access to notification hooks
|
||||||
|
# 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
|
||||||
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
757
conf/settings_history/settings.3.0.py
Normal file
757
conf/settings_history/settings.3.0.py
Normal file
|
@ -0,0 +1,757 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright © 2012 - 2018 Michal Čihař <michal@cihar.com>
|
||||||
|
#
|
||||||
|
# This file is part of Weblate <https://weblate.org/>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import platform
|
||||||
|
import os
|
||||||
|
from logging.handlers import SysLogHandler
|
||||||
|
|
||||||
|
#
|
||||||
|
# Django settings for Weblate project.
|
||||||
|
#
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
|
||||||
|
ADMINS = (
|
||||||
|
('__ADMIN__', '__ADMINMAIL__'),
|
||||||
|
)
|
||||||
|
|
||||||
|
MANAGERS = ADMINS
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
# Database engine
|
||||||
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
# Database name
|
||||||
|
'NAME': '__NAME__',
|
||||||
|
# Database user
|
||||||
|
'USER': '__NAME__',
|
||||||
|
# Database password
|
||||||
|
'PASSWORD': '__DB_PWD__',
|
||||||
|
# Set to empty string for localhost
|
||||||
|
'HOST': 'localhost',
|
||||||
|
# Set to empty string for default
|
||||||
|
'PORT': '5432',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR = '__FINALPATH__'
|
||||||
|
|
||||||
|
# Data directory
|
||||||
|
DATA_DIR = os.path.join(BASE_DIR, 'data')
|
||||||
|
|
||||||
|
# Local time zone for this installation. Choices can be found here:
|
||||||
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||||
|
# although not all choices may be available on all operating systems.
|
||||||
|
# In a Windows environment this must be set to your system time zone.
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
# Language code for this installation. All choices can be found here:
|
||||||
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
LANGUAGES = (
|
||||||
|
('ar', 'العربية'),
|
||||||
|
('az', 'Azərbaycan'),
|
||||||
|
('be', 'Беларуская'),
|
||||||
|
('be@latin', 'Biełaruskaja'),
|
||||||
|
('bg', 'Български'),
|
||||||
|
('br', 'Brezhoneg'),
|
||||||
|
('ca', 'Català'),
|
||||||
|
('cs', 'Čeština'),
|
||||||
|
('da', 'Dansk'),
|
||||||
|
('de', 'Deutsch'),
|
||||||
|
('en', 'English'),
|
||||||
|
('en-gb', 'English (United Kingdom)'),
|
||||||
|
('el', 'Ελληνικά'),
|
||||||
|
('es', 'Español'),
|
||||||
|
('fi', 'Suomi'),
|
||||||
|
('fr', 'Français'),
|
||||||
|
('fy', 'Frysk'),
|
||||||
|
('gl', 'Galego'),
|
||||||
|
('he', 'עברית'),
|
||||||
|
('hu', 'Magyar'),
|
||||||
|
('id', 'Indonesia'),
|
||||||
|
('it', 'Italiano'),
|
||||||
|
('ja', '日本語'),
|
||||||
|
('ko', '한국어'),
|
||||||
|
('ksh', 'Kölsch'),
|
||||||
|
('nb', 'Norsk bokmål'),
|
||||||
|
('nl', 'Nederlands'),
|
||||||
|
('pl', 'Polski'),
|
||||||
|
('pt', 'Português'),
|
||||||
|
('pt-br', 'Português brasileiro'),
|
||||||
|
('ru', 'Русский'),
|
||||||
|
('sk', 'Slovenčina'),
|
||||||
|
('sl', 'Slovenščina'),
|
||||||
|
('sr', 'Српски'),
|
||||||
|
('sv', 'Svenska'),
|
||||||
|
('tr', 'Türkçe'),
|
||||||
|
('uk', 'Українська'),
|
||||||
|
('zh-hans', '简体字'),
|
||||||
|
('zh-hant', '正體字'),
|
||||||
|
)
|
||||||
|
|
||||||
|
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 to use, please see documentation for more details
|
||||||
|
URL_PREFIX = '__PATHURL__'
|
||||||
|
|
||||||
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||||
|
# Example: "/home/media/media.lawrence.com/media/"
|
||||||
|
MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
|
||||||
|
|
||||||
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||||
|
# trailing slash.
|
||||||
|
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
||||||
|
MEDIA_URL = '{0}/media/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Absolute path to the directory static files should be collected to.
|
||||||
|
# Don't put anything in this directory yourself; store your static files
|
||||||
|
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||||
|
# Example: "/home/media/media.lawrence.com/static/"
|
||||||
|
STATIC_ROOT = os.path.join(DATA_DIR, 'static')
|
||||||
|
|
||||||
|
# URL prefix for static files.
|
||||||
|
# Example: "http://media.lawrence.com/static/"
|
||||||
|
STATIC_URL = '{0}/static/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Additional locations of static files
|
||||||
|
STATICFILES_DIRS = (
|
||||||
|
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||||
|
# Always use forward slashes, even on Windows.
|
||||||
|
# Don't forget to use absolute paths, not relative paths.
|
||||||
|
)
|
||||||
|
|
||||||
|
# List of finder classes that know how to find static files in
|
||||||
|
# various locations.
|
||||||
|
STATICFILES_FINDERS = (
|
||||||
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||||
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||||
|
'compressor.finders.CompressorFinder',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make this unique, and don't share it with anybody.
|
||||||
|
# You can generate it using examples/generate-secret-key
|
||||||
|
SECRET_KEY = '__KEY__' # noqa
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [
|
||||||
|
os.path.join(BASE_DIR, 'weblate', 'templates'),
|
||||||
|
],
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.i18n',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.template.context_processors.csrf',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
'weblate.trans.context_processors.weblate_context',
|
||||||
|
],
|
||||||
|
'loaders': [
|
||||||
|
('django.template.loaders.cached.Loader', [
|
||||||
|
'django.template.loaders.filesystem.Loader',
|
||||||
|
'django.template.loaders.app_directories.Loader',
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# GitHub username for sending pull requests.
|
||||||
|
# Please see the documentation for more details.
|
||||||
|
GITHUB_USERNAME = "__GITHUBUSER__"
|
||||||
|
|
||||||
|
# Authentication configuration
|
||||||
|
AUTHENTICATION_BACKENDS = (
|
||||||
|
'social_core.backends.email.EmailAuth',
|
||||||
|
# 'social_core.backends.google.GoogleOAuth2',
|
||||||
|
# 'social_core.backends.github.GithubOAuth2',
|
||||||
|
# 'social_core.backends.bitbucket.BitbucketOAuth',
|
||||||
|
'social_core.backends.suse.OpenSUSEOpenId',
|
||||||
|
'social_core.backends.ubuntu.UbuntuOpenId',
|
||||||
|
'social_core.backends.fedora.FedoraOpenId',
|
||||||
|
# 'social_core.backends.facebook.FacebookOAuth2',
|
||||||
|
'weblate.accounts.auth.WeblateUserBackend',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Custom user model
|
||||||
|
AUTH_USER_MODEL = 'weblate_auth.User'
|
||||||
|
|
||||||
|
# Social auth backends setup
|
||||||
|
SOCIAL_AUTH_GITHUB_KEY = ''
|
||||||
|
SOCIAL_AUTH_GITHUB_SECRET = ''
|
||||||
|
SOCIAL_AUTH_GITHUB_SCOPE = ['user:email']
|
||||||
|
|
||||||
|
SOCIAL_AUTH_BITBUCKET_KEY = ''
|
||||||
|
SOCIAL_AUTH_BITBUCKET_SECRET = ''
|
||||||
|
SOCIAL_AUTH_BITBUCKET_VERIFIED_EMAILS_ONLY = True
|
||||||
|
|
||||||
|
SOCIAL_AUTH_FACEBOOK_KEY = ''
|
||||||
|
SOCIAL_AUTH_FACEBOOK_SECRET = ''
|
||||||
|
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', 'public_profile']
|
||||||
|
|
||||||
|
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = ''
|
||||||
|
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ''
|
||||||
|
|
||||||
|
# Social auth settings
|
||||||
|
SOCIAL_AUTH_PIPELINE = (
|
||||||
|
'social_core.pipeline.social_auth.social_details',
|
||||||
|
'social_core.pipeline.social_auth.social_uid',
|
||||||
|
'social_core.pipeline.social_auth.auth_allowed',
|
||||||
|
'social_core.pipeline.social_auth.social_user',
|
||||||
|
'weblate.accounts.pipeline.store_params',
|
||||||
|
'weblate.accounts.pipeline.verify_open',
|
||||||
|
'social_core.pipeline.user.get_username',
|
||||||
|
'weblate.accounts.pipeline.require_email',
|
||||||
|
'social_core.pipeline.mail.mail_validation',
|
||||||
|
'weblate.accounts.pipeline.revoke_mail_code',
|
||||||
|
'weblate.accounts.pipeline.ensure_valid',
|
||||||
|
'weblate.accounts.pipeline.remove_account',
|
||||||
|
'social_core.pipeline.social_auth.associate_by_email',
|
||||||
|
'weblate.accounts.pipeline.reauthenticate',
|
||||||
|
'weblate.accounts.pipeline.verify_username',
|
||||||
|
'social_core.pipeline.user.create_user',
|
||||||
|
'social_core.pipeline.social_auth.associate_user',
|
||||||
|
'social_core.pipeline.social_auth.load_extra_data',
|
||||||
|
'weblate.accounts.pipeline.cleanup_next',
|
||||||
|
'weblate.accounts.pipeline.user_full_name',
|
||||||
|
'weblate.accounts.pipeline.store_email',
|
||||||
|
'weblate.accounts.pipeline.notify_connect',
|
||||||
|
'weblate.accounts.pipeline.password_reset',
|
||||||
|
)
|
||||||
|
SOCIAL_AUTH_DISCONNECT_PIPELINE = (
|
||||||
|
'social_core.pipeline.disconnect.allowed_to_disconnect',
|
||||||
|
'social_core.pipeline.disconnect.get_entries',
|
||||||
|
'social_core.pipeline.disconnect.revoke_tokens',
|
||||||
|
'weblate.accounts.pipeline.cycle_session',
|
||||||
|
'weblate.accounts.pipeline.adjust_primary_mail',
|
||||||
|
'weblate.accounts.pipeline.notify_disconnect',
|
||||||
|
'social_core.pipeline.disconnect.disconnect',
|
||||||
|
'weblate.accounts.pipeline.cleanup_next',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Custom authentication strategy
|
||||||
|
SOCIAL_AUTH_STRATEGY = 'weblate.accounts.strategy.WeblateStrategy'
|
||||||
|
|
||||||
|
# Raise exceptions so that we can handle them later
|
||||||
|
SOCIAL_AUTH_RAISE_EXCEPTIONS = True
|
||||||
|
|
||||||
|
SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = \
|
||||||
|
'weblate.accounts.pipeline.send_validation'
|
||||||
|
SOCIAL_AUTH_EMAIL_VALIDATION_URL = \
|
||||||
|
'{0}/accounts/email-sent/'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_LOGIN_ERROR_URL = \
|
||||||
|
'{0}/accounts/login/'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_EMAIL_FORM_URL = \
|
||||||
|
'{0}/accounts/email/'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = \
|
||||||
|
'{0}/accounts/profile/#auth'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ('email',)
|
||||||
|
SOCIAL_AUTH_SLUGIFY_USERNAMES = True
|
||||||
|
SOCIAL_AUTH_SLUGIFY_FUNCTION = 'weblate.accounts.pipeline.slugify_username'
|
||||||
|
|
||||||
|
# Password validation configuration
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
'OPTIONS': {
|
||||||
|
'min_length': 6,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'weblate.accounts.password_validation.CharsPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'weblate.accounts.password_validation.PastPasswordsValidator',
|
||||||
|
},
|
||||||
|
# Optional password strength validation by django-zxcvbn-password
|
||||||
|
# {
|
||||||
|
# 'NAME': 'zxcvbn_password.ZXCVBNValidator',
|
||||||
|
# 'OPTIONS': {
|
||||||
|
# 'min_score': 3,
|
||||||
|
# 'user_attributes': ('username', 'email', 'full_name')
|
||||||
|
# }
|
||||||
|
# },
|
||||||
|
]
|
||||||
|
|
||||||
|
# Middleware
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'weblate.accounts.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
'social_django.middleware.SocialAuthExceptionMiddleware',
|
||||||
|
'weblate.accounts.middleware.RequireLoginMiddleware',
|
||||||
|
'weblate.middleware.SecurityMiddleware',
|
||||||
|
'weblate.wladmin.middleware.ConfigurationErrorsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'weblate.urls'
|
||||||
|
|
||||||
|
# Django and Weblate apps
|
||||||
|
INSTALLED_APPS = (
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.sites',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'django.contrib.admin.apps.SimpleAdminConfig',
|
||||||
|
'django.contrib.admindocs',
|
||||||
|
'django.contrib.sitemaps',
|
||||||
|
'social_django',
|
||||||
|
'crispy_forms',
|
||||||
|
'compressor',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework.authtoken',
|
||||||
|
'weblate.addons',
|
||||||
|
'weblate.auth',
|
||||||
|
'weblate.checks',
|
||||||
|
'weblate.formats',
|
||||||
|
'weblate.machinery',
|
||||||
|
'weblate.trans',
|
||||||
|
'weblate.lang',
|
||||||
|
'weblate.langdata',
|
||||||
|
'weblate.memory',
|
||||||
|
'weblate.permissions',
|
||||||
|
'weblate.screenshots',
|
||||||
|
'weblate.accounts',
|
||||||
|
'weblate.utils',
|
||||||
|
'weblate.vcs',
|
||||||
|
'weblate.wladmin',
|
||||||
|
'weblate',
|
||||||
|
|
||||||
|
# Optional: Git exporter
|
||||||
|
# 'weblate.gitexport',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Path to locales
|
||||||
|
LOCALE_PATHS = (os.path.join(BASE_DIR, 'weblate', 'locale'), )
|
||||||
|
|
||||||
|
# Custom exception reporter to include some details
|
||||||
|
DEFAULT_EXCEPTION_REPORTER_FILTER = \
|
||||||
|
'weblate.trans.debug.WeblateExceptionReporterFilter'
|
||||||
|
|
||||||
|
# Default logging of Weblate messages
|
||||||
|
# - to syslog in production (if available)
|
||||||
|
# - otherwise to console
|
||||||
|
# - you can also choose 'logfile' to log into separate file
|
||||||
|
# after configuring it below
|
||||||
|
|
||||||
|
# Detect if we can connect to syslog
|
||||||
|
HAVE_SYSLOG = False
|
||||||
|
if platform.system() != 'Windows':
|
||||||
|
try:
|
||||||
|
handler = SysLogHandler(
|
||||||
|
address='/dev/log', facility=SysLogHandler.LOG_LOCAL2
|
||||||
|
)
|
||||||
|
handler.close()
|
||||||
|
HAVE_SYSLOG = True
|
||||||
|
except IOError:
|
||||||
|
HAVE_SYSLOG = False
|
||||||
|
|
||||||
|
if DEBUG or not HAVE_SYSLOG:
|
||||||
|
DEFAULT_LOG = 'console'
|
||||||
|
else:
|
||||||
|
DEFAULT_LOG = 'syslog'
|
||||||
|
|
||||||
|
# A sample logging configuration. The only tangible logging
|
||||||
|
# performed by this configuration is to send an email to
|
||||||
|
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||||
|
# See http://docs.djangoproject.com/en/stable/topics/logging for
|
||||||
|
# more details on how to customize your logging configuration.
|
||||||
|
LOGGING = {
|
||||||
|
'version': 1,
|
||||||
|
'disable_existing_loggers': True,
|
||||||
|
'filters': {
|
||||||
|
'require_debug_false': {
|
||||||
|
'()': 'django.utils.log.RequireDebugFalse'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'formatters': {
|
||||||
|
'syslog': {
|
||||||
|
'format': 'weblate[%(process)d]: %(levelname)s %(message)s'
|
||||||
|
},
|
||||||
|
'simple': {
|
||||||
|
'format': '%(levelname)s %(message)s'
|
||||||
|
},
|
||||||
|
'logfile': {
|
||||||
|
'format': '%(asctime)s %(levelname)s %(message)s'
|
||||||
|
},
|
||||||
|
'django.server': {
|
||||||
|
'()': 'django.utils.log.ServerFormatter',
|
||||||
|
'format': '[%(server_time)s] %(message)s',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'handlers': {
|
||||||
|
'mail_admins': {
|
||||||
|
'level': 'ERROR',
|
||||||
|
'filters': ['require_debug_false'],
|
||||||
|
'class': 'django.utils.log.AdminEmailHandler',
|
||||||
|
'include_html': True,
|
||||||
|
},
|
||||||
|
'console': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'formatter': 'simple'
|
||||||
|
},
|
||||||
|
'django.server': {
|
||||||
|
'level': 'INFO',
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'formatter': 'django.server',
|
||||||
|
},
|
||||||
|
'syslog': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'class': 'logging.handlers.SysLogHandler',
|
||||||
|
'formatter': 'syslog',
|
||||||
|
'address': '/dev/log',
|
||||||
|
'facility': SysLogHandler.LOG_LOCAL2,
|
||||||
|
},
|
||||||
|
# Logging to a file
|
||||||
|
# 'logfile': {
|
||||||
|
# 'level':'DEBUG',
|
||||||
|
# 'class':'logging.handlers.RotatingFileHandler',
|
||||||
|
# 'filename': "/var/log/weblate/weblate.log",
|
||||||
|
# 'maxBytes': 100000,
|
||||||
|
# 'backupCount': 3,
|
||||||
|
# 'formatter': 'logfile',
|
||||||
|
# },
|
||||||
|
},
|
||||||
|
'loggers': {
|
||||||
|
'django.request': {
|
||||||
|
'handlers': ['mail_admins', DEFAULT_LOG],
|
||||||
|
'level': 'ERROR',
|
||||||
|
'propagate': True,
|
||||||
|
},
|
||||||
|
'django.server': {
|
||||||
|
'handlers': ['django.server'],
|
||||||
|
'level': 'INFO',
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
# Logging database queries
|
||||||
|
# 'django.db.backends': {
|
||||||
|
# 'handlers': [DEFAULT_LOG],
|
||||||
|
# 'level': 'DEBUG',
|
||||||
|
# },
|
||||||
|
'weblate': {
|
||||||
|
'handlers': [DEFAULT_LOG],
|
||||||
|
'level': 'DEBUG',
|
||||||
|
},
|
||||||
|
# Logging VCS operations
|
||||||
|
# 'weblate-vcs': {
|
||||||
|
# 'handlers': [DEFAULT_LOG],
|
||||||
|
# 'level': 'DEBUG',
|
||||||
|
# },
|
||||||
|
# Python Social Auth logging
|
||||||
|
# 'social': {
|
||||||
|
# 'handlers': [DEFAULT_LOG],
|
||||||
|
# 'level': 'DEBUG',
|
||||||
|
# },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Logging of management commands to console
|
||||||
|
if (os.environ.get('DJANGO_IS_MANAGEMENT_COMMAND', False) and
|
||||||
|
'console' not in LOGGING['loggers']['weblate']['handlers']):
|
||||||
|
LOGGING['loggers']['weblate']['handlers'].append('console')
|
||||||
|
|
||||||
|
# Remove syslog setup if it's not present
|
||||||
|
if not HAVE_SYSLOG:
|
||||||
|
del LOGGING['handlers']['syslog']
|
||||||
|
|
||||||
|
# List of machine translations
|
||||||
|
# MT_SERVICES = (
|
||||||
|
# 'weblate.machinery.apertium.ApertiumAPYTranslation',
|
||||||
|
# 'weblate.machinery.deepl.DeepLTranslation',
|
||||||
|
# 'weblate.machinery.glosbe.GlosbeTranslation',
|
||||||
|
# 'weblate.machinery.google.GoogleTranslation',
|
||||||
|
# 'weblate.machinery.microsoft.MicrosoftCognitiveTranslation',
|
||||||
|
# 'weblate.machinery.mymemory.MyMemoryTranslation',
|
||||||
|
# 'weblate.machinery.tmserver.AmagamaTranslation',
|
||||||
|
# 'weblate.machinery.tmserver.TMServerTranslation',
|
||||||
|
# 'weblate.machinery.yandex.YandexTranslation',
|
||||||
|
# 'weblate.machinery.weblatetm.WeblateTranslation',
|
||||||
|
# 'weblate.machinery.saptranslationhub.SAPTranslationHub',
|
||||||
|
# 'weblate.memory.machine.WeblateMemory',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# Machine translation API keys
|
||||||
|
|
||||||
|
# URL of the Apertium APy server
|
||||||
|
MT_APERTIUM_APY = None
|
||||||
|
|
||||||
|
# DeepL API key
|
||||||
|
MT_DEEPL_KEY = None
|
||||||
|
|
||||||
|
# Microsoft Cognitive Services Translator API, register at
|
||||||
|
# https://portal.azure.com/
|
||||||
|
MT_MICROSOFT_COGNITIVE_KEY = None
|
||||||
|
|
||||||
|
# MyMemory identification email, see
|
||||||
|
# https://mymemory.translated.net/doc/spec.php
|
||||||
|
MT_MYMEMORY_EMAIL = None
|
||||||
|
|
||||||
|
# Optional MyMemory credentials to access private translation memory
|
||||||
|
MT_MYMEMORY_USER = None
|
||||||
|
MT_MYMEMORY_KEY = None
|
||||||
|
|
||||||
|
# Google API key for Google Translate API
|
||||||
|
MT_GOOGLE_KEY = None
|
||||||
|
|
||||||
|
# API key for Yandex Translate API
|
||||||
|
MT_YANDEX_KEY = None
|
||||||
|
|
||||||
|
# tmserver URL
|
||||||
|
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
|
||||||
|
SITE_TITLE = 'Weblate'
|
||||||
|
|
||||||
|
# Whether site uses https
|
||||||
|
ENABLE_HTTPS = True
|
||||||
|
|
||||||
|
# Use HTTPS when creating redirect URLs for social authentication, see
|
||||||
|
# documentation for more details:
|
||||||
|
# http://python-social-auth-docs.readthedocs.io/en/latest/configuration/settings.html#processing-redirects-and-urlopen
|
||||||
|
SOCIAL_AUTH_REDIRECT_IS_HTTPS = ENABLE_HTTPS
|
||||||
|
|
||||||
|
# Make CSRF cookie HttpOnly, see documentation for more details:
|
||||||
|
# https://docs.djangoproject.com/en/1.11/ref/settings/#csrf-cookie-httponly
|
||||||
|
CSRF_COOKIE_HTTPONLY = True
|
||||||
|
CSRF_COOKIE_SECURE = ENABLE_HTTPS
|
||||||
|
# Store CSRF token in session (since Django 1.11)
|
||||||
|
CSRF_USE_SESSIONS = True
|
||||||
|
SESSION_COOKIE_SECURE = ENABLE_HTTPS
|
||||||
|
# Session cookie age (in seconds)
|
||||||
|
SESSION_COOKIE_AGE = 1209600
|
||||||
|
|
||||||
|
# URL of login
|
||||||
|
LOGIN_URL = '{0}/accounts/login/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# URL of logout
|
||||||
|
LOGOUT_URL = '{0}/accounts/logout/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Default location for login
|
||||||
|
LOGIN_REDIRECT_URL = '{0}/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Anonymous user name
|
||||||
|
ANONYMOUS_USER_NAME = 'anonymous'
|
||||||
|
|
||||||
|
# Reverse proxy settings
|
||||||
|
IP_BEHIND_REVERSE_PROXY = False
|
||||||
|
IP_PROXY_HEADER = 'HTTP_X_FORWARDED_FOR'
|
||||||
|
IP_PROXY_OFFSET = 0
|
||||||
|
|
||||||
|
# Sending HTML in mails
|
||||||
|
EMAIL_SEND_HTML = True
|
||||||
|
|
||||||
|
# Subject of emails includes site title
|
||||||
|
EMAIL_SUBJECT_PREFIX = '[{0}] '.format(SITE_TITLE)
|
||||||
|
|
||||||
|
EMAIL_BACKEND = 'django_sendmail_backend.backends.EmailBackend'
|
||||||
|
|
||||||
|
# Enable remote hooks
|
||||||
|
ENABLE_HOOKS = True
|
||||||
|
|
||||||
|
# Whether to run hooks in background
|
||||||
|
BACKGROUND_HOOKS = True
|
||||||
|
|
||||||
|
# Number of nearby messages to show in each direction
|
||||||
|
NEARBY_MESSAGES = 5
|
||||||
|
|
||||||
|
# Offload indexing
|
||||||
|
OFFLOAD_INDEXING = True
|
||||||
|
|
||||||
|
# Use simple language codes for default language/country combinations
|
||||||
|
SIMPLIFY_LANGUAGES = True
|
||||||
|
|
||||||
|
# Render forms using bootstrap
|
||||||
|
CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
||||||
|
|
||||||
|
# List of quality checks
|
||||||
|
# CHECK_LIST = (
|
||||||
|
# 'weblate.checks.same.SameCheck',
|
||||||
|
# 'weblate.checks.chars.BeginNewlineCheck',
|
||||||
|
# 'weblate.checks.chars.EndNewlineCheck',
|
||||||
|
# 'weblate.checks.chars.BeginSpaceCheck',
|
||||||
|
# 'weblate.checks.chars.EndSpaceCheck',
|
||||||
|
# 'weblate.checks.chars.EndStopCheck',
|
||||||
|
# 'weblate.checks.chars.EndColonCheck',
|
||||||
|
# 'weblate.checks.chars.EndQuestionCheck',
|
||||||
|
# 'weblate.checks.chars.EndExclamationCheck',
|
||||||
|
# 'weblate.checks.chars.EndEllipsisCheck',
|
||||||
|
# 'weblate.checks.chars.EndSemicolonCheck',
|
||||||
|
# 'weblate.checks.chars.MaxLengthCheck',
|
||||||
|
# 'weblate.checks.format.PythonFormatCheck',
|
||||||
|
# 'weblate.checks.format.PythonBraceFormatCheck',
|
||||||
|
# 'weblate.checks.format.PHPFormatCheck',
|
||||||
|
# 'weblate.checks.format.CFormatCheck',
|
||||||
|
# 'weblate.checks.format.PerlFormatCheck',
|
||||||
|
# 'weblate.checks.format.JavascriptFormatCheck',
|
||||||
|
# 'weblate.checks.consistency.PluralsCheck',
|
||||||
|
# 'weblate.checks.consistency.SamePluralsCheck',
|
||||||
|
# 'weblate.checks.consistency.ConsistencyCheck',
|
||||||
|
# 'weblate.checks.consistency.TranslatedCheck',
|
||||||
|
# 'weblate.checks.chars.NewlineCountingCheck',
|
||||||
|
# 'weblate.checks.markup.BBCodeCheck',
|
||||||
|
# 'weblate.checks.chars.ZeroWidthSpaceCheck',
|
||||||
|
# 'weblate.checks.markup.XMLValidityCheck',
|
||||||
|
# 'weblate.checks.markup.XMLTagsCheck',
|
||||||
|
# 'weblate.checks.source.OptionalPluralCheck',
|
||||||
|
# 'weblate.checks.source.EllipsisCheck',
|
||||||
|
# 'weblate.checks.source.MultipleFailingCheck',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# List of automatic fixups
|
||||||
|
# AUTOFIX_LIST = (
|
||||||
|
# 'weblate.trans.autofixes.whitespace.SameBookendingWhitespace',
|
||||||
|
# 'weblate.trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
|
||||||
|
# 'weblate.trans.autofixes.chars.RemoveZeroSpace',
|
||||||
|
# '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.gettext.GettextAuthorComments',
|
||||||
|
# 'weblate.addons.cleanup.CleanupAddon',
|
||||||
|
# 'weblate.addons.consistency.LangaugeConsistencyAddon',
|
||||||
|
# 'weblate.addons.discovery.DiscoveryAddon',
|
||||||
|
# 'weblate.addons.flags.SourceEditAddon',
|
||||||
|
# 'weblate.addons.flags.TargetEditAddon',
|
||||||
|
# 'weblate.addons.generate.GenerateFileAddon',
|
||||||
|
# 'weblate.addons.json.JSONCustomizeAddon',
|
||||||
|
# 'weblate.addons.properties.PropertiesSortAddon',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# E-mail address that error messages come from.
|
||||||
|
SERVER_EMAIL = 'noreply@__DOMAIN__'
|
||||||
|
|
||||||
|
# Default email address to use for various automated correspondence from
|
||||||
|
# the site managers. Used for registration emails.
|
||||||
|
DEFAULT_FROM_EMAIL = '__ADMINMAIL__'
|
||||||
|
|
||||||
|
# List of URLs your site is supposed to serve
|
||||||
|
ALLOWED_HOSTS = ['__DOMAIN__']
|
||||||
|
|
||||||
|
# Example configuration to use memcached for caching
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||||
|
'LOCATION': '127.0.0.1:__MEMCPORT__',
|
||||||
|
},
|
||||||
|
'avatar': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
|
||||||
|
'LOCATION': os.path.join(BASE_DIR, 'avatar-cache'),
|
||||||
|
'TIMEOUT': 3600,
|
||||||
|
'OPTIONS': {
|
||||||
|
'MAX_ENTRIES': 1000,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# REST framework settings for API
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
# Use Django's standard `django.contrib.auth` permissions,
|
||||||
|
# or allow read-only access for unauthenticated users.
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': [
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly'
|
||||||
|
],
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework.authentication.TokenAuthentication',
|
||||||
|
'weblate.api.authentication.BearerAuthentication',
|
||||||
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_THROTTLE_CLASSES': (
|
||||||
|
'rest_framework.throttling.AnonRateThrottle',
|
||||||
|
'rest_framework.throttling.UserRateThrottle'
|
||||||
|
),
|
||||||
|
'DEFAULT_THROTTLE_RATES': {
|
||||||
|
'anon': '100/day',
|
||||||
|
'user': '1000/day'
|
||||||
|
},
|
||||||
|
'DEFAULT_PAGINATION_CLASS': (
|
||||||
|
'rest_framework.pagination.PageNumberPagination'
|
||||||
|
),
|
||||||
|
'PAGE_SIZE': 20,
|
||||||
|
'VIEW_DESCRIPTION_FUNCTION': 'weblate.api.views.get_view_description',
|
||||||
|
'UNAUTHENTICATED_USER': 'weblate.auth.models.get_anonymous',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Example for restricting access to logged in users
|
||||||
|
# LOGIN_REQUIRED_URLS = (
|
||||||
|
# r'/(.*)$',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# In such case you will want to include some of the exceptions
|
||||||
|
# LOGIN_REQUIRED_URLS_EXCEPTIONS = (
|
||||||
|
# r'/accounts/(.*)$', # Required for login
|
||||||
|
# r'/static/(.*)$', # Required for development mode
|
||||||
|
# r'/widgets/(.*)$', # Allowing public access to widgets
|
||||||
|
# r'/data/(.*)$', # Allowing public access to data exports
|
||||||
|
# r'/hooks/(.*)$', # Allowing public access to notification hooks
|
||||||
|
# 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
|
||||||
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
770
conf/settings_history/settings.3.1.1.py
Normal file
770
conf/settings_history/settings.3.1.1.py
Normal file
|
@ -0,0 +1,770 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright © 2012 - 2018 Michal Čihař <michal@cihar.com>
|
||||||
|
#
|
||||||
|
# This file is part of Weblate <https://weblate.org/>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import platform
|
||||||
|
import os
|
||||||
|
from logging.handlers import SysLogHandler
|
||||||
|
|
||||||
|
#
|
||||||
|
# Django settings for Weblate project.
|
||||||
|
#
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
|
||||||
|
ADMINS = (
|
||||||
|
('__ADMIN__', '__ADMINMAIL__'),
|
||||||
|
)
|
||||||
|
|
||||||
|
MANAGERS = ADMINS
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
# Database engine
|
||||||
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
# Database name
|
||||||
|
'NAME': '__NAME__',
|
||||||
|
# Database user
|
||||||
|
'USER': '__NAME__',
|
||||||
|
# Database password
|
||||||
|
'PASSWORD': '__DB_PWD__',
|
||||||
|
# Set to empty string for localhost
|
||||||
|
'HOST': 'localhost',
|
||||||
|
# Set to empty string for default
|
||||||
|
'PORT': '5432',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR = '__FINALPATH__'
|
||||||
|
|
||||||
|
# Data directory
|
||||||
|
DATA_DIR = os.path.join(BASE_DIR, 'data')
|
||||||
|
|
||||||
|
# Local time zone for this installation. Choices can be found here:
|
||||||
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||||
|
# although not all choices may be available on all operating systems.
|
||||||
|
# In a Windows environment this must be set to your system time zone.
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
# Language code for this installation. All choices can be found here:
|
||||||
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
LANGUAGES = (
|
||||||
|
('ar', 'العربية'),
|
||||||
|
('az', 'Azərbaycan'),
|
||||||
|
('be', 'Беларуская'),
|
||||||
|
('be@latin', 'Biełaruskaja'),
|
||||||
|
('bg', 'Български'),
|
||||||
|
('br', 'Brezhoneg'),
|
||||||
|
('ca', 'Català'),
|
||||||
|
('cs', 'Čeština'),
|
||||||
|
('da', 'Dansk'),
|
||||||
|
('de', 'Deutsch'),
|
||||||
|
('en', 'English'),
|
||||||
|
('en-gb', 'English (United Kingdom)'),
|
||||||
|
('el', 'Ελληνικά'),
|
||||||
|
('es', 'Español'),
|
||||||
|
('fi', 'Suomi'),
|
||||||
|
('fr', 'Français'),
|
||||||
|
('fy', 'Frysk'),
|
||||||
|
('gl', 'Galego'),
|
||||||
|
('he', 'עברית'),
|
||||||
|
('hu', 'Magyar'),
|
||||||
|
('id', 'Indonesia'),
|
||||||
|
('it', 'Italiano'),
|
||||||
|
('ja', '日本語'),
|
||||||
|
('ko', '한국어'),
|
||||||
|
('ksh', 'Kölsch'),
|
||||||
|
('nb', 'Norsk bokmål'),
|
||||||
|
('nl', 'Nederlands'),
|
||||||
|
('pl', 'Polski'),
|
||||||
|
('pt', 'Português'),
|
||||||
|
('pt-br', 'Português brasileiro'),
|
||||||
|
('ru', 'Русский'),
|
||||||
|
('sk', 'Slovenčina'),
|
||||||
|
('sl', 'Slovenščina'),
|
||||||
|
('sr', 'Српски'),
|
||||||
|
('sv', 'Svenska'),
|
||||||
|
('tr', 'Türkçe'),
|
||||||
|
('uk', 'Українська'),
|
||||||
|
('zh-hans', '简体字'),
|
||||||
|
('zh-hant', '正體字'),
|
||||||
|
)
|
||||||
|
|
||||||
|
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 to use, please see documentation for more details
|
||||||
|
URL_PREFIX = '__PATHURL__'
|
||||||
|
|
||||||
|
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||||
|
# Example: "/home/media/media.lawrence.com/media/"
|
||||||
|
MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
|
||||||
|
|
||||||
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||||
|
# trailing slash.
|
||||||
|
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
||||||
|
MEDIA_URL = '{0}/media/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Absolute path to the directory static files should be collected to.
|
||||||
|
# Don't put anything in this directory yourself; store your static files
|
||||||
|
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||||
|
# Example: "/home/media/media.lawrence.com/static/"
|
||||||
|
STATIC_ROOT = os.path.join(DATA_DIR, 'static')
|
||||||
|
|
||||||
|
# URL prefix for static files.
|
||||||
|
# Example: "http://media.lawrence.com/static/"
|
||||||
|
STATIC_URL = '{0}/static/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Additional locations of static files
|
||||||
|
STATICFILES_DIRS = (
|
||||||
|
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||||
|
# Always use forward slashes, even on Windows.
|
||||||
|
# Don't forget to use absolute paths, not relative paths.
|
||||||
|
)
|
||||||
|
|
||||||
|
# List of finder classes that know how to find static files in
|
||||||
|
# various locations.
|
||||||
|
STATICFILES_FINDERS = (
|
||||||
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||||
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||||
|
'compressor.finders.CompressorFinder',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make this unique, and don't share it with anybody.
|
||||||
|
# You can generate it using examples/generate-secret-key
|
||||||
|
SECRET_KEY = '__KEY__' # noqa
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [
|
||||||
|
os.path.join(BASE_DIR, 'weblate', 'templates'),
|
||||||
|
],
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.i18n',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.template.context_processors.csrf',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
'weblate.trans.context_processors.weblate_context',
|
||||||
|
],
|
||||||
|
'loaders': [
|
||||||
|
('django.template.loaders.cached.Loader', [
|
||||||
|
'django.template.loaders.filesystem.Loader',
|
||||||
|
'django.template.loaders.app_directories.Loader',
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# GitHub username for sending pull requests.
|
||||||
|
# Please see the documentation for more details.
|
||||||
|
GITHUB_USERNAME = "__GITHUBUSER__"
|
||||||
|
|
||||||
|
# Authentication configuration
|
||||||
|
AUTHENTICATION_BACKENDS = (
|
||||||
|
'social_core.backends.email.EmailAuth',
|
||||||
|
# 'social_core.backends.google.GoogleOAuth2',
|
||||||
|
# 'social_core.backends.github.GithubOAuth2',
|
||||||
|
# 'social_core.backends.bitbucket.BitbucketOAuth',
|
||||||
|
'social_core.backends.suse.OpenSUSEOpenId',
|
||||||
|
'social_core.backends.ubuntu.UbuntuOpenId',
|
||||||
|
'social_core.backends.fedora.FedoraOpenId',
|
||||||
|
# 'social_core.backends.facebook.FacebookOAuth2',
|
||||||
|
'weblate.accounts.auth.WeblateUserBackend',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Custom user model
|
||||||
|
AUTH_USER_MODEL = 'weblate_auth.User'
|
||||||
|
|
||||||
|
# Social auth backends setup
|
||||||
|
SOCIAL_AUTH_GITHUB_KEY = ''
|
||||||
|
SOCIAL_AUTH_GITHUB_SECRET = ''
|
||||||
|
SOCIAL_AUTH_GITHUB_SCOPE = ['user:email']
|
||||||
|
|
||||||
|
SOCIAL_AUTH_BITBUCKET_KEY = ''
|
||||||
|
SOCIAL_AUTH_BITBUCKET_SECRET = ''
|
||||||
|
SOCIAL_AUTH_BITBUCKET_VERIFIED_EMAILS_ONLY = True
|
||||||
|
|
||||||
|
SOCIAL_AUTH_FACEBOOK_KEY = ''
|
||||||
|
SOCIAL_AUTH_FACEBOOK_SECRET = ''
|
||||||
|
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', 'public_profile']
|
||||||
|
|
||||||
|
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = ''
|
||||||
|
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ''
|
||||||
|
|
||||||
|
# Social auth settings
|
||||||
|
SOCIAL_AUTH_PIPELINE = (
|
||||||
|
'social_core.pipeline.social_auth.social_details',
|
||||||
|
'social_core.pipeline.social_auth.social_uid',
|
||||||
|
'social_core.pipeline.social_auth.auth_allowed',
|
||||||
|
'social_core.pipeline.social_auth.social_user',
|
||||||
|
'weblate.accounts.pipeline.store_params',
|
||||||
|
'weblate.accounts.pipeline.verify_open',
|
||||||
|
'social_core.pipeline.user.get_username',
|
||||||
|
'weblate.accounts.pipeline.require_email',
|
||||||
|
'social_core.pipeline.mail.mail_validation',
|
||||||
|
'weblate.accounts.pipeline.revoke_mail_code',
|
||||||
|
'weblate.accounts.pipeline.ensure_valid',
|
||||||
|
'weblate.accounts.pipeline.remove_account',
|
||||||
|
'social_core.pipeline.social_auth.associate_by_email',
|
||||||
|
'weblate.accounts.pipeline.reauthenticate',
|
||||||
|
'weblate.accounts.pipeline.verify_username',
|
||||||
|
'social_core.pipeline.user.create_user',
|
||||||
|
'social_core.pipeline.social_auth.associate_user',
|
||||||
|
'social_core.pipeline.social_auth.load_extra_data',
|
||||||
|
'weblate.accounts.pipeline.cleanup_next',
|
||||||
|
'weblate.accounts.pipeline.user_full_name',
|
||||||
|
'weblate.accounts.pipeline.store_email',
|
||||||
|
'weblate.accounts.pipeline.notify_connect',
|
||||||
|
'weblate.accounts.pipeline.password_reset',
|
||||||
|
)
|
||||||
|
SOCIAL_AUTH_DISCONNECT_PIPELINE = (
|
||||||
|
'social_core.pipeline.disconnect.allowed_to_disconnect',
|
||||||
|
'social_core.pipeline.disconnect.get_entries',
|
||||||
|
'social_core.pipeline.disconnect.revoke_tokens',
|
||||||
|
'weblate.accounts.pipeline.cycle_session',
|
||||||
|
'weblate.accounts.pipeline.adjust_primary_mail',
|
||||||
|
'weblate.accounts.pipeline.notify_disconnect',
|
||||||
|
'social_core.pipeline.disconnect.disconnect',
|
||||||
|
'weblate.accounts.pipeline.cleanup_next',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Custom authentication strategy
|
||||||
|
SOCIAL_AUTH_STRATEGY = 'weblate.accounts.strategy.WeblateStrategy'
|
||||||
|
|
||||||
|
# Raise exceptions so that we can handle them later
|
||||||
|
SOCIAL_AUTH_RAISE_EXCEPTIONS = True
|
||||||
|
|
||||||
|
SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = \
|
||||||
|
'weblate.accounts.pipeline.send_validation'
|
||||||
|
SOCIAL_AUTH_EMAIL_VALIDATION_URL = \
|
||||||
|
'{0}/accounts/email-sent/'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_LOGIN_ERROR_URL = \
|
||||||
|
'{0}/accounts/login/'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_EMAIL_FORM_URL = \
|
||||||
|
'{0}/accounts/email/'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = \
|
||||||
|
'{0}/accounts/profile/#auth'.format(URL_PREFIX)
|
||||||
|
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ('email',)
|
||||||
|
SOCIAL_AUTH_SLUGIFY_USERNAMES = True
|
||||||
|
SOCIAL_AUTH_SLUGIFY_FUNCTION = 'weblate.accounts.pipeline.slugify_username'
|
||||||
|
|
||||||
|
# Password validation configuration
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
'OPTIONS': {
|
||||||
|
'min_length': 6,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'weblate.accounts.password_validation.CharsPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'weblate.accounts.password_validation.PastPasswordsValidator',
|
||||||
|
},
|
||||||
|
# Optional password strength validation by django-zxcvbn-password
|
||||||
|
# {
|
||||||
|
# 'NAME': 'zxcvbn_password.ZXCVBNValidator',
|
||||||
|
# 'OPTIONS': {
|
||||||
|
# 'min_score': 3,
|
||||||
|
# 'user_attributes': ('username', 'email', 'full_name')
|
||||||
|
# }
|
||||||
|
# },
|
||||||
|
]
|
||||||
|
|
||||||
|
# Middleware
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'weblate.accounts.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
'social_django.middleware.SocialAuthExceptionMiddleware',
|
||||||
|
'weblate.accounts.middleware.RequireLoginMiddleware',
|
||||||
|
'weblate.middleware.SecurityMiddleware',
|
||||||
|
'weblate.wladmin.middleware.ConfigurationErrorsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'weblate.urls'
|
||||||
|
|
||||||
|
# Django and Weblate apps
|
||||||
|
INSTALLED_APPS = (
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.sites',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'django.contrib.admin.apps.SimpleAdminConfig',
|
||||||
|
'django.contrib.admindocs',
|
||||||
|
'django.contrib.sitemaps',
|
||||||
|
'social_django',
|
||||||
|
'crispy_forms',
|
||||||
|
'compressor',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework.authtoken',
|
||||||
|
'weblate.addons',
|
||||||
|
'weblate.auth',
|
||||||
|
'weblate.checks',
|
||||||
|
'weblate.formats',
|
||||||
|
'weblate.machinery',
|
||||||
|
'weblate.trans',
|
||||||
|
'weblate.lang',
|
||||||
|
'weblate.langdata',
|
||||||
|
'weblate.memory',
|
||||||
|
'weblate.screenshots',
|
||||||
|
'weblate.accounts',
|
||||||
|
'weblate.utils',
|
||||||
|
'weblate.vcs',
|
||||||
|
'weblate.wladmin',
|
||||||
|
'weblate',
|
||||||
|
|
||||||
|
# Optional: Git exporter
|
||||||
|
# 'weblate.gitexport',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Path to locales
|
||||||
|
LOCALE_PATHS = (os.path.join(BASE_DIR, 'weblate', 'locale'), )
|
||||||
|
|
||||||
|
# Custom exception reporter to include some details
|
||||||
|
DEFAULT_EXCEPTION_REPORTER_FILTER = \
|
||||||
|
'weblate.trans.debug.WeblateExceptionReporterFilter'
|
||||||
|
|
||||||
|
# Default logging of Weblate messages
|
||||||
|
# - to syslog in production (if available)
|
||||||
|
# - otherwise to console
|
||||||
|
# - you can also choose 'logfile' to log into separate file
|
||||||
|
# after configuring it below
|
||||||
|
|
||||||
|
# Detect if we can connect to syslog
|
||||||
|
HAVE_SYSLOG = False
|
||||||
|
if platform.system() != 'Windows':
|
||||||
|
try:
|
||||||
|
handler = SysLogHandler(
|
||||||
|
address='/dev/log', facility=SysLogHandler.LOG_LOCAL2
|
||||||
|
)
|
||||||
|
handler.close()
|
||||||
|
HAVE_SYSLOG = True
|
||||||
|
except IOError:
|
||||||
|
HAVE_SYSLOG = False
|
||||||
|
|
||||||
|
if DEBUG or not HAVE_SYSLOG:
|
||||||
|
DEFAULT_LOG = 'console'
|
||||||
|
else:
|
||||||
|
DEFAULT_LOG = 'syslog'
|
||||||
|
|
||||||
|
# A sample logging configuration. The only tangible logging
|
||||||
|
# performed by this configuration is to send an email to
|
||||||
|
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||||
|
# See http://docs.djangoproject.com/en/stable/topics/logging for
|
||||||
|
# more details on how to customize your logging configuration.
|
||||||
|
LOGGING = {
|
||||||
|
'version': 1,
|
||||||
|
'disable_existing_loggers': True,
|
||||||
|
'filters': {
|
||||||
|
'require_debug_false': {
|
||||||
|
'()': 'django.utils.log.RequireDebugFalse'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'formatters': {
|
||||||
|
'syslog': {
|
||||||
|
'format': 'weblate[%(process)d]: %(levelname)s %(message)s'
|
||||||
|
},
|
||||||
|
'simple': {
|
||||||
|
'format': '%(levelname)s %(message)s'
|
||||||
|
},
|
||||||
|
'logfile': {
|
||||||
|
'format': '%(asctime)s %(levelname)s %(message)s'
|
||||||
|
},
|
||||||
|
'django.server': {
|
||||||
|
'()': 'django.utils.log.ServerFormatter',
|
||||||
|
'format': '[%(server_time)s] %(message)s',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'handlers': {
|
||||||
|
'mail_admins': {
|
||||||
|
'level': 'ERROR',
|
||||||
|
'filters': ['require_debug_false'],
|
||||||
|
'class': 'django.utils.log.AdminEmailHandler',
|
||||||
|
'include_html': True,
|
||||||
|
},
|
||||||
|
'console': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'formatter': 'simple'
|
||||||
|
},
|
||||||
|
'django.server': {
|
||||||
|
'level': 'INFO',
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'formatter': 'django.server',
|
||||||
|
},
|
||||||
|
'syslog': {
|
||||||
|
'level': 'DEBUG',
|
||||||
|
'class': 'logging.handlers.SysLogHandler',
|
||||||
|
'formatter': 'syslog',
|
||||||
|
'address': '/dev/log',
|
||||||
|
'facility': SysLogHandler.LOG_LOCAL2,
|
||||||
|
},
|
||||||
|
# Logging to a file
|
||||||
|
# 'logfile': {
|
||||||
|
# 'level':'DEBUG',
|
||||||
|
# 'class':'logging.handlers.RotatingFileHandler',
|
||||||
|
# 'filename': "/var/log/weblate/weblate.log",
|
||||||
|
# 'maxBytes': 100000,
|
||||||
|
# 'backupCount': 3,
|
||||||
|
# 'formatter': 'logfile',
|
||||||
|
# },
|
||||||
|
},
|
||||||
|
'loggers': {
|
||||||
|
'django.request': {
|
||||||
|
'handlers': ['mail_admins', DEFAULT_LOG],
|
||||||
|
'level': 'ERROR',
|
||||||
|
'propagate': True,
|
||||||
|
},
|
||||||
|
'django.server': {
|
||||||
|
'handlers': ['django.server'],
|
||||||
|
'level': 'INFO',
|
||||||
|
'propagate': False,
|
||||||
|
},
|
||||||
|
# Logging database queries
|
||||||
|
# 'django.db.backends': {
|
||||||
|
# 'handlers': [DEFAULT_LOG],
|
||||||
|
# 'level': 'DEBUG',
|
||||||
|
# },
|
||||||
|
'weblate': {
|
||||||
|
'handlers': [DEFAULT_LOG],
|
||||||
|
'level': 'DEBUG',
|
||||||
|
},
|
||||||
|
# Logging VCS operations
|
||||||
|
# 'weblate-vcs': {
|
||||||
|
# 'handlers': [DEFAULT_LOG],
|
||||||
|
# 'level': 'DEBUG',
|
||||||
|
# },
|
||||||
|
# Python Social Auth logging
|
||||||
|
# 'social': {
|
||||||
|
# 'handlers': [DEFAULT_LOG],
|
||||||
|
# 'level': 'DEBUG',
|
||||||
|
# },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Logging of management commands to console
|
||||||
|
if (os.environ.get('DJANGO_IS_MANAGEMENT_COMMAND', False) and
|
||||||
|
'console' not in LOGGING['loggers']['weblate']['handlers']):
|
||||||
|
LOGGING['loggers']['weblate']['handlers'].append('console')
|
||||||
|
|
||||||
|
# Remove syslog setup if it's not present
|
||||||
|
if not HAVE_SYSLOG:
|
||||||
|
del LOGGING['handlers']['syslog']
|
||||||
|
|
||||||
|
# List of machine translations
|
||||||
|
# MT_SERVICES = (
|
||||||
|
# 'weblate.machinery.apertium.ApertiumAPYTranslation',
|
||||||
|
# 'weblate.machinery.deepl.DeepLTranslation',
|
||||||
|
# 'weblate.machinery.glosbe.GlosbeTranslation',
|
||||||
|
# 'weblate.machinery.google.GoogleTranslation',
|
||||||
|
# 'weblate.machinery.microsoft.MicrosoftCognitiveTranslation',
|
||||||
|
# 'weblate.machinery.mymemory.MyMemoryTranslation',
|
||||||
|
# 'weblate.machinery.tmserver.AmagamaTranslation',
|
||||||
|
# 'weblate.machinery.tmserver.TMServerTranslation',
|
||||||
|
# 'weblate.machinery.yandex.YandexTranslation',
|
||||||
|
# 'weblate.machinery.weblatetm.WeblateTranslation',
|
||||||
|
# 'weblate.machinery.saptranslationhub.SAPTranslationHub',
|
||||||
|
# 'weblate.memory.machine.WeblateMemory',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# Machine translation API keys
|
||||||
|
|
||||||
|
# URL of the Apertium APy server
|
||||||
|
MT_APERTIUM_APY = None
|
||||||
|
|
||||||
|
# DeepL API key
|
||||||
|
MT_DEEPL_KEY = None
|
||||||
|
|
||||||
|
# Microsoft Cognitive Services Translator API, register at
|
||||||
|
# https://portal.azure.com/
|
||||||
|
MT_MICROSOFT_COGNITIVE_KEY = None
|
||||||
|
|
||||||
|
# MyMemory identification email, see
|
||||||
|
# https://mymemory.translated.net/doc/spec.php
|
||||||
|
MT_MYMEMORY_EMAIL = None
|
||||||
|
|
||||||
|
# Optional MyMemory credentials to access private translation memory
|
||||||
|
MT_MYMEMORY_USER = None
|
||||||
|
MT_MYMEMORY_KEY = None
|
||||||
|
|
||||||
|
# Google API key for Google Translate API
|
||||||
|
MT_GOOGLE_KEY = None
|
||||||
|
|
||||||
|
# API key for Yandex Translate API
|
||||||
|
MT_YANDEX_KEY = None
|
||||||
|
|
||||||
|
# tmserver URL
|
||||||
|
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
|
||||||
|
SITE_TITLE = 'Weblate'
|
||||||
|
|
||||||
|
# Whether site uses https
|
||||||
|
ENABLE_HTTPS = True
|
||||||
|
|
||||||
|
# Use HTTPS when creating redirect URLs for social authentication, see
|
||||||
|
# documentation for more details:
|
||||||
|
# http://python-social-auth-docs.readthedocs.io/en/latest/configuration/settings.html#processing-redirects-and-urlopen
|
||||||
|
SOCIAL_AUTH_REDIRECT_IS_HTTPS = ENABLE_HTTPS
|
||||||
|
|
||||||
|
# Make CSRF cookie HttpOnly, see documentation for more details:
|
||||||
|
# https://docs.djangoproject.com/en/1.11/ref/settings/#csrf-cookie-httponly
|
||||||
|
CSRF_COOKIE_HTTPONLY = True
|
||||||
|
CSRF_COOKIE_SECURE = ENABLE_HTTPS
|
||||||
|
# Store CSRF token in session (since Django 1.11)
|
||||||
|
CSRF_USE_SESSIONS = True
|
||||||
|
SESSION_COOKIE_SECURE = ENABLE_HTTPS
|
||||||
|
# SSL redirect
|
||||||
|
SECURE_SSL_REDIRECT = ENABLE_HTTPS
|
||||||
|
# Session cookie age (in seconds)
|
||||||
|
SESSION_COOKIE_AGE = 1209600
|
||||||
|
|
||||||
|
# Some security headers
|
||||||
|
SECURE_BROWSER_XSS_FILTER = True
|
||||||
|
X_FRAME_OPTIONS = 'DENY'
|
||||||
|
SECURE_CONTENT_TYPE_NOSNIFF = True
|
||||||
|
|
||||||
|
# Optionally enable HSTS
|
||||||
|
SECURE_HSTS_SECONDS = 0
|
||||||
|
SECURE_HSTS_PRELOAD = False
|
||||||
|
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
|
||||||
|
|
||||||
|
# URL of login
|
||||||
|
LOGIN_URL = '{0}/accounts/login/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# URL of logout
|
||||||
|
LOGOUT_URL = '{0}/accounts/logout/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Default location for login
|
||||||
|
LOGIN_REDIRECT_URL = '{0}/'.format(URL_PREFIX)
|
||||||
|
|
||||||
|
# Anonymous user name
|
||||||
|
ANONYMOUS_USER_NAME = 'anonymous'
|
||||||
|
|
||||||
|
# Reverse proxy settings
|
||||||
|
IP_BEHIND_REVERSE_PROXY = False
|
||||||
|
IP_PROXY_HEADER = 'HTTP_X_FORWARDED_FOR'
|
||||||
|
IP_PROXY_OFFSET = 0
|
||||||
|
|
||||||
|
# Sending HTML in mails
|
||||||
|
EMAIL_SEND_HTML = True
|
||||||
|
|
||||||
|
# Subject of emails includes site title
|
||||||
|
EMAIL_SUBJECT_PREFIX = '[{0}] '.format(SITE_TITLE)
|
||||||
|
|
||||||
|
EMAIL_BACKEND = 'django_sendmail_backend.backends.EmailBackend'
|
||||||
|
|
||||||
|
# Enable remote hooks
|
||||||
|
ENABLE_HOOKS = True
|
||||||
|
|
||||||
|
# Whether to run hooks in background
|
||||||
|
BACKGROUND_HOOKS = True
|
||||||
|
|
||||||
|
# Number of nearby messages to show in each direction
|
||||||
|
NEARBY_MESSAGES = 5
|
||||||
|
|
||||||
|
# Offload indexing
|
||||||
|
OFFLOAD_INDEXING = True
|
||||||
|
|
||||||
|
# Use simple language codes for default language/country combinations
|
||||||
|
SIMPLIFY_LANGUAGES = True
|
||||||
|
|
||||||
|
# Render forms using bootstrap
|
||||||
|
CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
||||||
|
|
||||||
|
# List of quality checks
|
||||||
|
# CHECK_LIST = (
|
||||||
|
# 'weblate.checks.same.SameCheck',
|
||||||
|
# 'weblate.checks.chars.BeginNewlineCheck',
|
||||||
|
# 'weblate.checks.chars.EndNewlineCheck',
|
||||||
|
# 'weblate.checks.chars.BeginSpaceCheck',
|
||||||
|
# 'weblate.checks.chars.EndSpaceCheck',
|
||||||
|
# 'weblate.checks.chars.EndStopCheck',
|
||||||
|
# 'weblate.checks.chars.EndColonCheck',
|
||||||
|
# 'weblate.checks.chars.EndQuestionCheck',
|
||||||
|
# 'weblate.checks.chars.EndExclamationCheck',
|
||||||
|
# 'weblate.checks.chars.EndEllipsisCheck',
|
||||||
|
# 'weblate.checks.chars.EndSemicolonCheck',
|
||||||
|
# 'weblate.checks.chars.MaxLengthCheck',
|
||||||
|
# 'weblate.checks.format.PythonFormatCheck',
|
||||||
|
# 'weblate.checks.format.PythonBraceFormatCheck',
|
||||||
|
# 'weblate.checks.format.PHPFormatCheck',
|
||||||
|
# 'weblate.checks.format.CFormatCheck',
|
||||||
|
# 'weblate.checks.format.PerlFormatCheck',
|
||||||
|
# 'weblate.checks.format.JavascriptFormatCheck',
|
||||||
|
# 'weblate.checks.consistency.PluralsCheck',
|
||||||
|
# 'weblate.checks.consistency.SamePluralsCheck',
|
||||||
|
# 'weblate.checks.consistency.ConsistencyCheck',
|
||||||
|
# 'weblate.checks.consistency.TranslatedCheck',
|
||||||
|
# 'weblate.checks.chars.NewlineCountingCheck',
|
||||||
|
# 'weblate.checks.markup.BBCodeCheck',
|
||||||
|
# 'weblate.checks.chars.ZeroWidthSpaceCheck',
|
||||||
|
# 'weblate.checks.markup.XMLValidityCheck',
|
||||||
|
# 'weblate.checks.markup.XMLTagsCheck',
|
||||||
|
# 'weblate.checks.source.OptionalPluralCheck',
|
||||||
|
# 'weblate.checks.source.EllipsisCheck',
|
||||||
|
# 'weblate.checks.source.MultipleFailingCheck',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# List of automatic fixups
|
||||||
|
# AUTOFIX_LIST = (
|
||||||
|
# 'weblate.trans.autofixes.whitespace.SameBookendingWhitespace',
|
||||||
|
# 'weblate.trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis',
|
||||||
|
# 'weblate.trans.autofixes.chars.RemoveZeroSpace',
|
||||||
|
# '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.gettext.GettextAuthorComments',
|
||||||
|
# 'weblate.addons.cleanup.CleanupAddon',
|
||||||
|
# 'weblate.addons.consistency.LangaugeConsistencyAddon',
|
||||||
|
# 'weblate.addons.discovery.DiscoveryAddon',
|
||||||
|
# 'weblate.addons.flags.SourceEditAddon',
|
||||||
|
# 'weblate.addons.flags.TargetEditAddon',
|
||||||
|
# 'weblate.addons.generate.GenerateFileAddon',
|
||||||
|
# 'weblate.addons.json.JSONCustomizeAddon',
|
||||||
|
# 'weblate.addons.properties.PropertiesSortAddon',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# E-mail address that error messages come from.
|
||||||
|
SERVER_EMAIL = 'noreply@__DOMAIN__'
|
||||||
|
|
||||||
|
# Default email address to use for various automated correspondence from
|
||||||
|
# the site managers. Used for registration emails.
|
||||||
|
DEFAULT_FROM_EMAIL = '__ADMINMAIL__'
|
||||||
|
|
||||||
|
# List of URLs your site is supposed to serve
|
||||||
|
ALLOWED_HOSTS = ['__DOMAIN__']
|
||||||
|
|
||||||
|
# Example configuration to use memcached for caching
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||||
|
'LOCATION': '127.0.0.1:__MEMCPORT__',
|
||||||
|
},
|
||||||
|
'avatar': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
|
||||||
|
'LOCATION': os.path.join(BASE_DIR, 'avatar-cache'),
|
||||||
|
'TIMEOUT': 3600,
|
||||||
|
'OPTIONS': {
|
||||||
|
'MAX_ENTRIES': 1000,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# REST framework settings for API
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
# Use Django's standard `django.contrib.auth` permissions,
|
||||||
|
# or allow read-only access for unauthenticated users.
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': [
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly'
|
||||||
|
],
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework.authentication.TokenAuthentication',
|
||||||
|
'weblate.api.authentication.BearerAuthentication',
|
||||||
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_THROTTLE_CLASSES': (
|
||||||
|
'rest_framework.throttling.AnonRateThrottle',
|
||||||
|
'rest_framework.throttling.UserRateThrottle'
|
||||||
|
),
|
||||||
|
'DEFAULT_THROTTLE_RATES': {
|
||||||
|
'anon': '100/day',
|
||||||
|
'user': '1000/day'
|
||||||
|
},
|
||||||
|
'DEFAULT_PAGINATION_CLASS': (
|
||||||
|
'rest_framework.pagination.PageNumberPagination'
|
||||||
|
),
|
||||||
|
'PAGE_SIZE': 20,
|
||||||
|
'VIEW_DESCRIPTION_FUNCTION': 'weblate.api.views.get_view_description',
|
||||||
|
'UNAUTHENTICATED_USER': 'weblate.auth.models.get_anonymous',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Example for restricting access to logged in users
|
||||||
|
# LOGIN_REQUIRED_URLS = (
|
||||||
|
# r'/(.*)$',
|
||||||
|
# )
|
||||||
|
|
||||||
|
# In such case you will want to include some of the exceptions
|
||||||
|
# LOGIN_REQUIRED_URLS_EXCEPTIONS = (
|
||||||
|
# r'/accounts/(.*)$', # Required for login
|
||||||
|
# r'/admin/login/(.*)$', # Required for admin login
|
||||||
|
# r'/static/(.*)$', # Required for development mode
|
||||||
|
# r'/widgets/(.*)$', # Allowing public access to widgets
|
||||||
|
# r'/data/(.*)$', # Allowing public access to data exports
|
||||||
|
# r'/hooks/(.*)$', # Allowing public access to notification hooks
|
||||||
|
# r'/healthz/$', # Allowing public access to health check
|
||||||
|
# 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
|
||||||
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
18
hooks/post_app_upgrade
Normal file
18
hooks/post_app_upgrade
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
migration311=$(yunohost app setting "$YNH_APP_INSTANCE_NAME" "migration311" --output-as plain --quiet)
|
||||||
|
mig_type=$(yunohost app setting "$YNH_APP_INSTANCE_NAME" "migration311_type" --output-as plain --quiet)
|
||||||
|
mig_parm=$(yunohost app setting "$YNH_APP_INSTANCE_NAME" "migration311_parm" --output-as plain --quiet)
|
||||||
|
|
||||||
|
if [[ "$migration311" = "two_steps_upgrade_3.0to3.1-needed" ]]
|
||||||
|
then
|
||||||
|
yunohost app setting "$YNH_APP_INSTANCE_NAME" "migration311" --value="two_steps_upgrade_3.0to3.1-progress" --quiet
|
||||||
|
if [ "$mig_type" = "file" ]
|
||||||
|
then
|
||||||
|
yunohost app upgrade "$YNH_APP_INSTANCE_NAME" --file "$mig_parm"
|
||||||
|
else
|
||||||
|
yunohost app upgrade "$YNH_APP_INSTANCE_NAME" --url "$mig_parm"
|
||||||
|
fi
|
||||||
|
|
||||||
|
yunohost app setting "$YNH_APP_INSTANCE_NAME" "migration311" --value="two_steps_upgrade_3.0to3.1-done" --quiet
|
||||||
|
fi
|
|
@ -3,12 +3,12 @@
|
||||||
"id": "weblate",
|
"id": "weblate",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.10"
|
"yunohost": ">= 3.1.0"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"en": "A translation platform using Git and Python"
|
"en": "A translation platform using Git and Python"
|
||||||
},
|
},
|
||||||
"version": "2.20-1",
|
"version": "3.1.1~ynh2",
|
||||||
"url": "https://weblate.org",
|
"url": "https://weblate.org",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
current_version="2.20"
|
current_version="3.1.1"
|
||||||
|
|
||||||
ynh_check_global_uwsgi_config () {
|
ynh_check_global_uwsgi_config () {
|
||||||
uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency"
|
uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency"
|
||||||
|
@ -82,7 +82,7 @@ ynh_remove_uwsgi_service () {
|
||||||
|
|
||||||
|
|
||||||
weblate_fill_settings() {
|
weblate_fill_settings() {
|
||||||
settings="$1"
|
local settings="$1"
|
||||||
|
|
||||||
ynh_replace_string "__NAME__" "$app" "$settings"
|
ynh_replace_string "__NAME__" "$app" "$settings"
|
||||||
ynh_replace_string "__DB_PWD__" "$db_pwd" "$settings"
|
ynh_replace_string "__DB_PWD__" "$db_pwd" "$settings"
|
||||||
|
@ -117,165 +117,6 @@ ynh_check_if_checksum_is_different() {
|
||||||
echo "$check"
|
echo "$check"
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
|
||||||
#
|
|
||||||
# POSTGRES HELPERS
|
|
||||||
#
|
|
||||||
# Point of contact : Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr>
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Create a master password and set up global settings
|
|
||||||
# Please always call this script in install and restore scripts
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_test_if_first_run
|
|
||||||
|
|
||||||
ynh_psql_test_if_first_run() {
|
|
||||||
if [ -f /etc/yunohost/psql ];
|
|
||||||
then
|
|
||||||
echo "PostgreSQL is already installed, no need to create master password"
|
|
||||||
else
|
|
||||||
pgsql=$(ynh_string_random)
|
|
||||||
pg_hba=""
|
|
||||||
echo "$pgsql" >> /etc/yunohost/psql
|
|
||||||
|
|
||||||
if [ -e /etc/postgresql/9.4/ ]
|
|
||||||
then
|
|
||||||
pg_hba=/etc/postgresql/9.4/main/pg_hba.conf
|
|
||||||
elif [ -e /etc/postgresql/9.6/ ]
|
|
||||||
then
|
|
||||||
pg_hba=/etc/postgresql/9.6/main/pg_hba.conf
|
|
||||||
else
|
|
||||||
ynh_die "postgresql shoud be 9.4 or 9.6"
|
|
||||||
fi
|
|
||||||
|
|
||||||
systemctl start postgresql
|
|
||||||
sudo --login --user=postgres psql -c"ALTER user postgres WITH PASSWORD '$pgsql'" postgres
|
|
||||||
|
|
||||||
# force all user to connect to local database using passwords
|
|
||||||
# https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html#EXAMPLE-PG-HBA.CONF
|
|
||||||
# Note: we can't use peer since YunoHost create users with nologin
|
|
||||||
# See: https://github.com/YunoHost/yunohost/blob/unstable/data/helpers.d/user
|
|
||||||
sed -i '/local\s*all\s*all\s*peer/i \
|
|
||||||
local all all password' "$pg_hba"
|
|
||||||
systemctl enable postgresql
|
|
||||||
systemctl reload postgresql
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Open a connection as a user
|
|
||||||
#
|
|
||||||
# example: ynh_psql_connect_as 'user' 'pass' <<< "UPDATE ...;"
|
|
||||||
# example: ynh_psql_connect_as 'user' 'pass' < /path/to/file.sql
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_connect_as user pwd [db]
|
|
||||||
# | arg: user - the user name to connect as
|
|
||||||
# | arg: pwd - the user password
|
|
||||||
# | arg: db - the database to connect to
|
|
||||||
ynh_psql_connect_as() {
|
|
||||||
user="$1"
|
|
||||||
pwd="$2"
|
|
||||||
db="$3"
|
|
||||||
sudo --login --user=postgres PGUSER="$user" PGPASSWORD="$pwd" psql "$db"
|
|
||||||
}
|
|
||||||
|
|
||||||
# # Execute a command as root user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_execute_as_root sql [db]
|
|
||||||
# | arg: sql - the SQL command to execute
|
|
||||||
# | arg: db - the database to connect to
|
|
||||||
ynh_psql_execute_as_root () {
|
|
||||||
sql="$1"
|
|
||||||
sudo --login --user=postgres psql <<< "$sql"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Execute a command from a file as root user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_execute_file_as_root file [db]
|
|
||||||
# | arg: file - the file containing SQL commands
|
|
||||||
# | arg: db - the database to connect to
|
|
||||||
ynh_psql_execute_file_as_root() {
|
|
||||||
file="$1"
|
|
||||||
db="$2"
|
|
||||||
sudo --login --user=postgres psql "$db" < "$file"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a database, an user and its password. Then store the password in the app's config
|
|
||||||
#
|
|
||||||
# After executing this helper, the password of the created database will be available in $db_pwd
|
|
||||||
# It will also be stored as "psqlpwd" into the app settings.
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_setup_db user name [pwd]
|
|
||||||
# | arg: user - Owner of the database
|
|
||||||
# | arg: name - Name of the database
|
|
||||||
# | arg: pwd - Password of the database. If not given, a password will be generated
|
|
||||||
ynh_psql_setup_db () {
|
|
||||||
db_user="$1"
|
|
||||||
db_name="$2"
|
|
||||||
new_db_pwd=$(ynh_string_random) # Generate a random password
|
|
||||||
# If $3 is not given, use new_db_pwd instead for db_pwd.
|
|
||||||
db_pwd="${3:-$new_db_pwd}"
|
|
||||||
ynh_psql_create_db "$db_name" "$db_user" "$db_pwd" # Create the database
|
|
||||||
ynh_app_setting_set "$app" psqlpwd "$db_pwd" # Store the password in the app's config
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a database and grant privilegies to a user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_create_db db [user [pwd]]
|
|
||||||
# | arg: db - the database name to create
|
|
||||||
# | arg: user - the user to grant privilegies
|
|
||||||
# | arg: pwd - the user password
|
|
||||||
ynh_psql_create_db() {
|
|
||||||
db="$1"
|
|
||||||
user="$2"
|
|
||||||
pwd="$3"
|
|
||||||
ynh_psql_create_user "$user" "$pwd"
|
|
||||||
sudo --login --user=postgres createdb --owner="$user" "$db"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Drop a database
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_drop_db db
|
|
||||||
# | arg: db - the database name to drop
|
|
||||||
# | arg: user - the user to drop
|
|
||||||
ynh_psql_remove_db() {
|
|
||||||
db="$1"
|
|
||||||
user="$2"
|
|
||||||
sudo --login --user=postgres dropdb "$db"
|
|
||||||
ynh_psql_drop_user "$user"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Dump a database
|
|
||||||
#
|
|
||||||
# example: ynh_psql_dump_db 'roundcube' > ./dump.sql
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_dump_db db
|
|
||||||
# | arg: db - the database name to dump
|
|
||||||
# | ret: the psqldump output
|
|
||||||
ynh_psql_dump_db() {
|
|
||||||
db="$1"
|
|
||||||
sudo --login --user=postgres pg_dump "$db"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Create a user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_create_user user pwd [host]
|
|
||||||
# | arg: user - the user name to create
|
|
||||||
ynh_psql_create_user() {
|
|
||||||
user="$1"
|
|
||||||
pwd="$2"
|
|
||||||
sudo --login --user=postgres psql -c"CREATE USER $user WITH PASSWORD '$pwd'" postgres
|
|
||||||
}
|
|
||||||
|
|
||||||
# Drop a user
|
|
||||||
#
|
|
||||||
# usage: ynh_psql_drop_user user
|
|
||||||
# | arg: user - the user name to drop
|
|
||||||
ynh_psql_drop_user() {
|
|
||||||
user="$1"
|
|
||||||
sudo --login --user=postgres dropuser "$user"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Send an email to inform the administrator
|
# Send an email to inform the administrator
|
||||||
#
|
#
|
||||||
# usage: ynh_send_readme_to_admin app_message [recipients]
|
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||||
|
@ -285,7 +126,7 @@ ynh_psql_drop_user() {
|
||||||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||||
# example: "root admin@domain user1 user2"
|
# example: "root admin@domain user1 user2"
|
||||||
ynh_send_readme_to_admin() {
|
ynh_send_readme_to_admin() {
|
||||||
local app_message="${1:-...No specific informations...}"
|
local app_message="${1:-...No specific information...}"
|
||||||
local recipients="${2:-root}"
|
local recipients="${2:-root}"
|
||||||
|
|
||||||
# Retrieve the email of users
|
# Retrieve the email of users
|
||||||
|
@ -315,12 +156,24 @@ ynh_send_readme_to_admin() {
|
||||||
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
|
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
|
||||||
|
|
||||||
local mail_message="This is an automated message from your beloved YunoHost server.
|
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||||
Specific informations for the application $app.
|
|
||||||
|
Specific information for the application $app.
|
||||||
|
|
||||||
$app_message
|
$app_message
|
||||||
|
|
||||||
---
|
---
|
||||||
Automatic diagnosis data from YunoHost
|
Automatic diagnosis data from YunoHost
|
||||||
|
|
||||||
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
||||||
|
|
||||||
|
# Define binary to use for mail command
|
||||||
|
if [ -e /usr/bin/bsd-mailx ]
|
||||||
|
then
|
||||||
|
local mail_bin=/usr/bin/bsd-mailx
|
||||||
|
else
|
||||||
|
local mail_bin=/usr/bin/mail.mailutils
|
||||||
|
fi
|
||||||
|
|
||||||
# Send the email to the recipients
|
# Send the email to the recipients
|
||||||
echo "$mail_message" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ virtualenv "${final_path}/venv"
|
||||||
#=================================================
|
#=================================================
|
||||||
db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
|
db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
|
||||||
admin_mail=$(ynh_user_get_info "$admin" mail)
|
admin_mail=$(ynh_user_get_info "$admin" mail)
|
||||||
key=$(ynh_string_random)
|
key=$(ynh_string_random 24)$(ynh_string_random 24)$(ynh_string_random 2)
|
||||||
memc_port=$(ynh_find_port 8080)
|
memc_port=$(ynh_find_port 8080)
|
||||||
settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
||||||
cp "../conf/settings_history/settings.$current_version.py" "$settings"
|
cp "../conf/settings_history/settings.$current_version.py" "$settings"
|
||||||
|
@ -239,6 +239,7 @@ ynh_app_setting_set "$app" memc_port "$memc_port"
|
||||||
# SETUP CRON
|
# SETUP CRON
|
||||||
#=================================================
|
#=================================================
|
||||||
cp ../conf/cron "/etc/cron.d/$app"
|
cp ../conf/cron "/etc/cron.d/$app"
|
||||||
|
ynh_replace_string "__APP__" "$app" "/etc/cron.d/$app"
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app"
|
ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
120
scripts/upgrade
120
scripts/upgrade
|
@ -8,8 +8,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -26,7 +24,8 @@ admin=$(ynh_app_setting_get "$app" admin)
|
||||||
admin_mail=$(ynh_user_get_info "$admin" mail)
|
admin_mail=$(ynh_user_get_info "$admin" mail)
|
||||||
memc_port=$(ynh_app_setting_get "$app" memc_port)
|
memc_port=$(ynh_app_setting_get "$app" memc_port)
|
||||||
github_account=$(ynh_app_setting_get "$app" github_account)
|
github_account=$(ynh_app_setting_get "$app" github_account)
|
||||||
key=$(ynh_string_random)
|
migration311=$(ynh_app_setting_get "$app" migration311)
|
||||||
|
key=$(ynh_string_random 24)$(ynh_string_random 24)$(ynh_string_random 2)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Get previous version number
|
# Get previous version number
|
||||||
|
@ -41,8 +40,10 @@ key=$(ynh_string_random)
|
||||||
)
|
)
|
||||||
previous_version=$(cat freeze.pip | grep "Weblate==" | sed "s|Weblate==||")
|
previous_version=$(cat freeze.pip | grep "Weblate==" | sed "s|Weblate==||")
|
||||||
|
|
||||||
previous_version_file="../conf/settings_history/settings.$previous_version.py"
|
ynh_secure_remove freeze.pip
|
||||||
test -e "$previous_version_file" || ynh_die "Previous version unknown: $previous_version"
|
|
||||||
|
previous_version_template="../conf/settings_history/settings.$previous_version.py"
|
||||||
|
test -e "$previous_version_template" || ynh_die "Previous version unknown: $previous_version"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -84,7 +85,7 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# (<2.20) remove your old sockets!
|
# (<2.20) remove your old sockets!
|
||||||
if [ -e "/etc/systemd/system/uwsgi-app@.socket" ]
|
if [ -e "/etc/systemd/system/uwsgi-app@$app.socket" ]
|
||||||
then
|
then
|
||||||
systemctl stop "uwsgi-app@$app.socket"
|
systemctl stop "uwsgi-app@$app.socket"
|
||||||
yunohost service remove "uwsgi-app@$app.socket"
|
yunohost service remove "uwsgi-app@$app.socket"
|
||||||
|
@ -104,6 +105,47 @@ then
|
||||||
ynh_secure_remove "$final_path/bin/"
|
ynh_secure_remove "$final_path/bin/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Weblate requires an update to 3.0 before 3.1
|
||||||
|
# the upgrade hook will launch this script again to make sure it works
|
||||||
|
if [[ -z "$migration311" ]]
|
||||||
|
then
|
||||||
|
# $migration311 is not set, version is <3.0
|
||||||
|
migration311="two_steps_upgrade_3.0to3.1-needed"
|
||||||
|
|
||||||
|
mig_type=$(cat "/etc/yunohost/apps/$YNH_APP_ID/status.json" | sed -e 's/.*"type":.*"\(.\+\)".*/\1/gi')
|
||||||
|
|
||||||
|
if [ "$mig_type" = "file" ]
|
||||||
|
then
|
||||||
|
mig_parm=$(cat "/etc/yunohost/apps/$YNH_APP_ID/status.json" | sed -e 's/.*"path": "\(.\+\)",.*/\1/gi')
|
||||||
|
else
|
||||||
|
mig_parm=$(cat "/etc/yunohost/apps/$YNH_APP_ID/status.json" | sed -e 's/.*"url": "\(.\+\)", "type".*/\1/gi')
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_app_setting_set "$app" migration311 "$migration311"
|
||||||
|
ynh_app_setting_set "$app" migration311_type "$mig_type"
|
||||||
|
ynh_app_setting_set "$app" migration311_parm "$mig_parm"
|
||||||
|
current_version="3.0.1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure the uwsgi service is stoped
|
||||||
|
if [[ -e "/var/run/uwsgi/$app.socket" ]]
|
||||||
|
then
|
||||||
|
systemctl stop "uwsgi-app@$app.service"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE PATH
|
# CHECK THE PATH
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -165,12 +207,6 @@ fi
|
||||||
# PIP INSTALLATION
|
# PIP INSTALLATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# save old settings file
|
|
||||||
cp "$settings" "$final_path/settings.$previous_version.old.py"
|
|
||||||
|
|
||||||
old_settings="./settings.$previous_version.old.py"
|
|
||||||
settings_diff="$final_path/settings.${previous_version}_${current_version}.diff"
|
|
||||||
|
|
||||||
(
|
(
|
||||||
set +o nounset
|
set +o nounset
|
||||||
source "${final_path}/venv/bin/activate"
|
source "${final_path}/venv/bin/activate"
|
||||||
|
@ -184,34 +220,44 @@ settings_diff="$final_path/settings.${previous_version}_${current_version}.diff"
|
||||||
pip install django_sendmail_backend
|
pip install django_sendmail_backend
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CONFIG FILE UPGRADE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# save old settings file
|
||||||
|
|
||||||
|
old_settings="$final_path/settings.$previous_version.old.py"
|
||||||
|
|
||||||
|
cp "$settings" "$old_settings"
|
||||||
|
|
||||||
check=$(ynh_check_if_checksum_is_different "$settings")
|
check=$(ynh_check_if_checksum_is_different "$settings")
|
||||||
|
|
||||||
if [[ "$check" -eq 1 ]]
|
if [[ "$check" -eq 1 ]]
|
||||||
then
|
then
|
||||||
echo "Settings.py was modified localy, running diff before using the new default file for $current_version."
|
echo "Settings.py was modified localy, running diff before using the new default file for $current_version."
|
||||||
# generate previous defaults settings
|
# generate previous defaults settings
|
||||||
cp "$previous_version_file" "$old_settings"
|
cp "$previous_version_template" "$old_settings"
|
||||||
weblate_fill_settings "$old_settings"
|
weblate_fill_settings "$old_settings"
|
||||||
|
|
||||||
# store diff between defaults and local settings
|
# store diff between defaults and local settings
|
||||||
diff --unified "$old_settings" "$settings" > "$settings_diff"
|
set +eu
|
||||||
|
diff --unified "$old_settings" "$settings" > "$final_path/settings.${previous_version}_${current_version}.diff"
|
||||||
# generate new defaults settings
|
set -eu
|
||||||
cp "../conf/settings_history/settings.$current_version.py" "$settings"
|
|
||||||
weblate_fill_settings "$settings"
|
|
||||||
|
|
||||||
# send diff to the server administrator
|
# send diff to the server administrator
|
||||||
mail_message="
|
mail_message="
|
||||||
Weblate was updated from version $previous_version to $current_version
|
Weblate was updated from version $previous_version to $current_version
|
||||||
|
Please read:
|
||||||
|
https://docs.weblate.org/en/latest/admin/upgrade.html
|
||||||
|
|
||||||
A new settings.py has been created in:
|
A new settings.py has been created:
|
||||||
$settings
|
$settings
|
||||||
|
|
||||||
You may have changed your defaults settings.
|
You may have changed your defaults settings.
|
||||||
To help you to apply it again, here is a diff file with every changes you did.
|
To help you, here is a diff file with every changes you did.
|
||||||
|
|
||||||
Diff has been created in:
|
Diff has been created in:
|
||||||
$settings_diff
|
$final_path/settings.${previous_version}_${current_version}.diff
|
||||||
|
|
||||||
Please note secret key is updated, this is normal.
|
Please note secret key is updated, this is normal.
|
||||||
|
|
||||||
|
@ -221,11 +267,14 @@ then
|
||||||
ynh_send_readme_to_admin "$mail_message" root "$admin_mail"
|
ynh_send_readme_to_admin "$mail_message" root "$admin_mail"
|
||||||
else
|
else
|
||||||
echo "Settings.py was not modified, using the new default file for $current_version."
|
echo "Settings.py was not modified, using the new default file for $current_version."
|
||||||
# generate new defaults settings
|
|
||||||
cp "../conf/settings_history/settings.$current_version.py" "$settings"
|
|
||||||
weblate_fill_settings "$settings"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# generate new defaults settings
|
||||||
|
cp "../conf/settings_history/settings.$current_version.py" "$settings"
|
||||||
|
weblate_fill_settings "$settings"
|
||||||
|
|
||||||
|
ynh_secure_remove "$old_settings"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Run migration scripts
|
# Run migration scripts
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -236,6 +285,22 @@ fi
|
||||||
set -o nounset
|
set -o nounset
|
||||||
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
||||||
cd "${final_path}"
|
cd "${final_path}"
|
||||||
|
|
||||||
|
# https://docs.weblate.org/en/latest/admin/upgrade.html#upgrade-3
|
||||||
|
# https://github.com/WeblateOrg/docker/blob/386aa8d98bb57dfec3707680827d4e4f4d79e3fd/start#L81-L88
|
||||||
|
if [[ $current_version = "3.0.1" ]]
|
||||||
|
then
|
||||||
|
weblate showmigrations --plan > /tmp/migrations.txt
|
||||||
|
if grep -Fq '[X] auth.0001_initial' /tmp/migrations.txt && grep -Fq '[ ] weblate_auth.0001_initial' /tmp/migrations.txt ; then
|
||||||
|
ynh_replace_string "AUTH_USER_MODEL" "#AUTH_USER_MODEL" "$settings"
|
||||||
|
weblate migrate weblate_auth 0001
|
||||||
|
ynh_replace_string "#AUTH_USER_MODEL" "AUTH_USER_MODEL" "$settings"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_secure_remove /tmp/migrations.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
weblate migrate --noinput
|
weblate migrate --noinput
|
||||||
weblate collectstatic --noinput
|
weblate collectstatic --noinput
|
||||||
weblate setuplang
|
weblate setuplang
|
||||||
|
@ -257,6 +322,13 @@ fi
|
||||||
# Recalculate and store the config file checksum into the app settings
|
# Recalculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
ynh_store_file_checksum "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP CRON
|
||||||
|
#=================================================
|
||||||
|
cp ../conf/cron "/etc/cron.d/$app"
|
||||||
|
ynh_replace_string "__APP__" "$app" "/etc/cron.d/$app"
|
||||||
|
ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue