mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Update settings
This commit is contained in:
parent
e5284f0acc
commit
180db15121
1 changed files with 23 additions and 28 deletions
|
@ -11,25 +11,9 @@
|
|||
|
||||
################################################################################
|
||||
################################################################################
|
||||
# Copyright © Michal Čihař <michal@weblate.org>
|
||||
#
|
||||
# Copyright © 2012–2022 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/>.
|
||||
#
|
||||
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import os
|
||||
import platform
|
||||
|
@ -48,7 +32,7 @@ ENABLE_HTTPS = True
|
|||
# Django settings for Weblate project.
|
||||
#
|
||||
|
||||
DEBUG = False
|
||||
DEBUG = True
|
||||
|
||||
ADMINS = (
|
||||
('__ADMIN__', '__ADMIN_MAIL__'),
|
||||
|
@ -95,6 +79,7 @@ DATABASES = {
|
|||
# Data directory, you can use following for the development purposes:
|
||||
# os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "data")
|
||||
DATA_DIR = os.path.join("__FINALPATH__", "data")
|
||||
CACHE_DIR = f"{DATA_DIR}/cache"
|
||||
|
||||
# Local time zone for this installation. Choices can be found here:
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
|
@ -183,7 +168,7 @@ MEDIA_URL = f"{URL_PREFIX}/media/"
|
|||
# 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.
|
||||
STATIC_ROOT = os.path.join(DATA_DIR, "static")
|
||||
STATIC_ROOT = os.path.join(CACHE_DIR, "static")
|
||||
|
||||
# URL prefix for static files.
|
||||
STATIC_URL = f"{URL_PREFIX}/static/"
|
||||
|
@ -244,6 +229,10 @@ GITLAB_CREDENTIALS = {
|
|||
}
|
||||
}
|
||||
|
||||
# Bitbucket username and token for sending merge requests.
|
||||
# Please see the documentation for more details.
|
||||
BITBUCKETSERVER_CREDENTIALS = {}
|
||||
|
||||
# Authentication configuration
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
"social_core.backends.email.EmailAuth",
|
||||
|
@ -378,6 +367,7 @@ REQUIRE_LOGIN = False
|
|||
MIDDLEWARE = [
|
||||
"weblate.middleware.RedirectMiddleware",
|
||||
"weblate.middleware.ProxyMiddleware",
|
||||
"corsheaders.middleware.CorsMiddleware",
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
|
@ -430,10 +420,13 @@ INSTALLED_APPS = [
|
|||
# Third party Django modules
|
||||
"social_django",
|
||||
"crispy_forms",
|
||||
"crispy_bootstrap3",
|
||||
"compressor",
|
||||
"rest_framework",
|
||||
"rest_framework.authtoken",
|
||||
"django_filters",
|
||||
"django_celery_beat",
|
||||
"corsheaders",
|
||||
]
|
||||
|
||||
# Custom exception reporter to include some details
|
||||
|
@ -455,10 +448,7 @@ if platform.system() != "Windows":
|
|||
except OSError:
|
||||
HAVE_SYSLOG = False
|
||||
|
||||
if DEBUG or not HAVE_SYSLOG:
|
||||
DEFAULT_LOG = "console"
|
||||
else:
|
||||
DEFAULT_LOG = "syslog"
|
||||
DEFAULT_LOG = "console" if DEBUG or not HAVE_SYSLOG else "syslog"
|
||||
DEFAULT_LOGLEVEL = "DEBUG" if DEBUG else "INFO"
|
||||
|
||||
# A sample logging configuration. The only tangible logging
|
||||
|
@ -713,6 +703,7 @@ LIMIT_TRANSLATION_LENGTH_BY_SOURCE_LENGTH = True
|
|||
SIMPLIFY_LANGUAGES = True
|
||||
|
||||
# Render forms using bootstrap
|
||||
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap3"
|
||||
CRISPY_TEMPLATE_PACK = "bootstrap3"
|
||||
|
||||
# List of quality checks
|
||||
|
@ -850,7 +841,7 @@ CACHES = {
|
|||
},
|
||||
"avatar": {
|
||||
"BACKEND": "django.core.cache.backends.filebased.FileBasedCache",
|
||||
"LOCATION": os.path.join(DATA_DIR, "avatar-cache"),
|
||||
"LOCATION": os.path.join(CACHE_DIR, "avatar"),
|
||||
"TIMEOUT": 86400,
|
||||
"OPTIONS": {"MAX_ENTRIES": 1000},
|
||||
},
|
||||
|
@ -881,8 +872,8 @@ REST_FRAMEWORK = {
|
|||
"weblate.api.throttling.AnonRateThrottle",
|
||||
),
|
||||
"DEFAULT_THROTTLE_RATES": {"anon": "100/day", "user": "5000/hour"},
|
||||
"DEFAULT_PAGINATION_CLASS": ("rest_framework.pagination.PageNumberPagination"),
|
||||
"PAGE_SIZE": 20,
|
||||
"DEFAULT_PAGINATION_CLASS": "weblate.api.pagination.StandardPagination",
|
||||
"PAGE_SIZE": 50,
|
||||
"VIEW_DESCRIPTION_FUNCTION": "weblate.api.views.get_view_description",
|
||||
"UNAUTHENTICATED_USER": "weblate.auth.models.get_anonymous",
|
||||
}
|
||||
|
@ -935,7 +926,7 @@ CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
|||
|
||||
# Celery settings, it is not recommended to change these
|
||||
CELERY_WORKER_MAX_MEMORY_PER_CHILD = 200000
|
||||
CELERY_BEAT_SCHEDULE_FILENAME = os.path.join(DATA_DIR, "celery", "beat-schedule")
|
||||
CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"
|
||||
CELERY_TASK_ROUTES = {
|
||||
"weblate.trans.tasks.auto_translate*": {"queue": "translate"},
|
||||
"weblate.accounts.tasks.notify_*": {"queue": "notify"},
|
||||
|
@ -947,6 +938,10 @@ CELERY_TASK_ROUTES = {
|
|||
"weblate.memory.tasks.*": {"queue": "memory"},
|
||||
}
|
||||
|
||||
# CORS allowed origins
|
||||
CORS_ALLOWED_ORIGINS = []
|
||||
CORS_URLS_REGEX = r"^/api/.*$"
|
||||
|
||||
# Enable plain database backups
|
||||
DATABASE_BACKUP = "plain"
|
||||
|
||||
|
|
Loading…
Reference in a new issue