diff options
author | buckE <buckE@disroot.org> | 2020-05-11 07:20:52 +0000 |
---|---|---|
committer | buckE <buckE@disroot.org> | 2020-05-11 07:20:52 +0000 |
commit | 591863ed64b858956edbea81b070fa5ee5cabbf9 (patch) | |
tree | 3ac27377a84e323308e160aeabdd07ecc1f2d0c9 /weblate/settings.py | |
parent | 1889794f88dac0cac98da7d180a617f8750b1091 (diff) | |
download | deployment-591863ed64b858956edbea81b070fa5ee5cabbf9.tar.gz deployment-591863ed64b858956edbea81b070fa5ee5cabbf9.tar.bz2 deployment-591863ed64b858956edbea81b070fa5ee5cabbf9.zip |
updated files per 4.0.3
Diffstat (limited to 'weblate/settings.py')
-rw-r--r-- | weblate/settings.py | 318 |
1 files changed, 162 insertions, 156 deletions
diff --git a/weblate/settings.py b/weblate/settings.py index e83bfc9..7caca60 100644 --- a/weblate/settings.py +++ b/weblate/settings.py @@ -1,5 +1,4 @@ -# /home/weblate/weblate-env/lib/python3.8/site-packages/weblate/settings.py - +# # Copyright © 2012 - 2020 Michal Čihař <michal@cihar.com> # # This file is part of Weblate <https://weblate.org/> @@ -30,7 +29,7 @@ from logging.handlers import SysLogHandler DEBUG = False ADMINS = ( - ('Weblate Admin', 'weblate@taler.net'), + ("Weblate Admin", "weblate@taler.net"), ) MANAGERS = ADMINS @@ -144,7 +143,7 @@ MEDIA_ROOT = os.path.join(DATA_DIR, "media") # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. -MEDIA_URL = "{0}/media/".format(URL_PREFIX) +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 @@ -152,7 +151,7 @@ MEDIA_URL = "{0}/media/".format(URL_PREFIX) STATIC_ROOT = os.path.join(DATA_DIR, "static") # URL prefix for static files. -STATIC_URL = "{0}/static/".format(URL_PREFIX) +STATIC_URL = f"{URL_PREFIX}/static/" # Additional locations of static files STATICFILES_DIRS = ( @@ -182,7 +181,6 @@ if not DEBUG: TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [os.path.join(BASE_DIR, "weblate", "templates")], "OPTIONS": { "context_processors": [ "django.contrib.auth.context_processors.auth", @@ -210,13 +208,13 @@ GITLAB_USERNAME = None # 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', + # "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", ) @@ -310,10 +308,10 @@ AUTH_PASSWORD_VALIDATORS = [ {"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') + # "NAME": "zxcvbn_password.ZXCVBNValidator", + # "OPTIONS": { + # "min_score": 3, + # "user_attributes": ("username", "email", "full_name") # } # }, ] @@ -321,6 +319,9 @@ AUTH_PASSWORD_VALIDATORS = [ # Allow new user registrations REGISTRATION_OPEN = True +# Shortcut for login required setting +LOGIN_REQUIRED = False + # Middleware MIDDLEWARE = [ "weblate.middleware.ProxyMiddleware", @@ -341,21 +342,7 @@ 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", - "django.contrib.humanize", - "social_django", - "crispy_forms", - "compressor", - "rest_framework", - "rest_framework.authtoken", + # Weblate apps on top to override Django locales and templates "weblate.addons", "weblate.auth", "weblate.checks", @@ -374,18 +361,32 @@ INSTALLED_APPS = [ "weblate", # Optional: Git exporter "weblate.gitexport", + # Standard Django modules + "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", + "django.contrib.humanize", + # Third party Django modules + "social_django", + "crispy_forms", + "compressor", + "rest_framework", + "rest_framework.authtoken", ] -# 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 +# - you can also choose "logfile" to log into separate file # after configuring it below # Detect if we can connect to syslog @@ -467,9 +468,9 @@ LOGGING = { "propagate": False, }, # Logging database queries - # 'django.db.backends': { - # 'handlers': [DEFAULT_LOG], - # 'level': 'DEBUG', + # "django.db.backends": { + # "handlers": [DEFAULT_LOG], + # "level": "DEBUG", # }, "weblate": {"handlers": [DEFAULT_LOG], "level": "DEBUG"}, # Logging search operations @@ -491,24 +492,24 @@ if not HAVE_SYSLOG: del LOGGING["handlers"]["syslog"] # List of machine translations -# MT_SERVICES = ( -# 'weblate.machinery.apertium.ApertiumAPYTranslation', -# 'weblate.machinery.baidu.BaiduTranslation', -# 'weblate.machinery.deepl.DeepLTranslation', -# 'weblate.machinery.glosbe.GlosbeTranslation', -# 'weblate.machinery.google.GoogleTranslation', -# 'weblate.machinery.microsoft.MicrosoftCognitiveTranslation', -# 'weblate.machinery.microsoftterminology.MicrosoftTerminologyService', -# 'weblate.machinery.mymemory.MyMemoryTranslation', -# 'weblate.machinery.netease.NeteaseSightTranslation', -# 'weblate.machinery.tmserver.AmagamaTranslation', -# 'weblate.machinery.tmserver.TMServerTranslation', -# 'weblate.machinery.yandex.YandexTranslation', -# 'weblate.machinery.weblatetm.WeblateTranslation', -# 'weblate.machinery.saptranslationhub.SAPTranslationHub', -# 'weblate.machinery.youdao.YoudaoTranslation', -# 'weblate.memory.machine.WeblateMemory', -# ) +MT_SERVICES = ( +# "weblate.machinery.apertium.ApertiumAPYTranslation", +# "weblate.machinery.baidu.BaiduTranslation", +# "weblate.machinery.deepl.DeepLTranslation", +# "weblate.machinery.glosbe.GlosbeTranslation", +# "weblate.machinery.google.GoogleTranslation", +# "weblate.machinery.microsoft.MicrosoftCognitiveTranslation", +# "weblate.machinery.microsoftterminology.MicrosoftTerminologyService", +"weblate.machinery.mymemory.MyMemoryTranslation", +# "weblate.machinery.netease.NeteaseSightTranslation", +# "weblate.machinery.tmserver.AmagamaTranslation", +# "weblate.machinery.tmserver.TMServerTranslation", +# "weblate.machinery.yandex.YandexTranslation", +# "weblate.machinery.saptranslationhub.SAPTranslationHub", +# "weblate.machinery.youdao.YoudaoTranslation", +# "weblate.machinery.weblatetm.WeblateTranslation", +# "weblate.memory.machine.WeblateMemory", +) # Machine translation API keys @@ -525,7 +526,7 @@ MT_MICROSOFT_REGION = None # MyMemory identification email, see # https://mymemory.translated.net/doc/spec.php -MT_MYMEMORY_EMAIL = None +MT_MYMEMORY_EMAIL = "ops@taler.net" # Optional MyMemory credentials to access private translation memory MT_MYMEMORY_USER = None @@ -560,7 +561,7 @@ MT_SAP_PASSWORD = None MT_SAP_USE_MT = True # Title of site to use -SITE_TITLE = "GNU Taler Weblate Translations" +SITE_TITLE = "Weblate" # Whether site uses https ENABLE_HTTPS = False @@ -578,7 +579,8 @@ CSRF_COOKIE_SECURE = ENABLE_HTTPS CSRF_USE_SESSIONS = True # Customize CSRF failure view CSRF_FAILURE_VIEW = "weblate.trans.views.error.csrf_failure" -SESSION_COOKIE_SECURE = ENABLE_HTTPS +SESSION_COOKIE_SECURE = True +ENABLE_HTTPS # SSL redirect SECURE_SSL_REDIRECT = ENABLE_HTTPS # Sent referrrer only for same origin links @@ -642,99 +644,99 @@ 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.DoubleSpaceCheck', -# '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.chars.KashidaCheck', -# 'weblate.checks.chars.PuctuationSpacingCheck', -# '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.format.CSharpFormatCheck', -# 'weblate.checks.format.JavaFormatCheck', -# 'weblate.checks.format.JavaMessageFormatCheck', +# "weblate.checks.same.SameCheck", +# "weblate.checks.chars.BeginNewlineCheck", +# "weblate.checks.chars.EndNewlineCheck", +# "weblate.checks.chars.BeginSpaceCheck", +# "weblate.checks.chars.EndSpaceCheck", +# "weblate.checks.chars.DoubleSpaceCheck", +# "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.chars.KashidaCheck", +# "weblate.checks.chars.PuctuationSpacingCheck", +# "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.format.CSharpFormatCheck", +# "weblate.checks.format.JavaFormatCheck", +# "weblate.checks.format.JavaMessageFormatCheck", # "weblate.checks.format.PercentPlaceholdersCheck", # "weblate.checks.format.I18NextInterpolationCheck", -# 'weblate.checks.angularjs.AngularJSInterpolationCheck', -# 'weblate.checks.qt.QtFormatCheck', -# 'weblate.checks.qt.QtPluralCheck', -# 'weblate.checks.ruby.RubyFormatCheck', -# 'weblate.checks.consistency.PluralsCheck', -# 'weblate.checks.consistency.SamePluralsCheck', -# 'weblate.checks.consistency.ConsistencyCheck', -# 'weblate.checks.consistency.TranslatedCheck', -# 'weblate.checks.chars.EscapedNewlineCountingCheck', -# 'weblate.checks.chars.NewLineCountCheck', -# 'weblate.checks.markup.BBCodeCheck', -# 'weblate.checks.chars.ZeroWidthSpaceCheck', -# 'weblate.checks.render.MaxSizeCheck', -# 'weblate.checks.markup.XMLValidityCheck', -# 'weblate.checks.markup.XMLTagsCheck', -# 'weblate.checks.markup.MarkdownRefLinkCheck', -# 'weblate.checks.markup.MarkdownLinkCheck', -# 'weblate.checks.markup.MarkdownSyntaxCheck', -# 'weblate.checks.markup.URLCheck', -# 'weblate.checks.markup.SafeHTMLCheck', -# 'weblate.checks.placeholders.PlaceholderCheck', -# 'weblate.checks.placeholders.RegexCheck', -# 'weblate.checks.source.OptionalPluralCheck', -# 'weblate.checks.source.EllipsisCheck', -# 'weblate.checks.source.MultipleFailingCheck', +# "weblate.checks.angularjs.AngularJSInterpolationCheck", +# "weblate.checks.qt.QtFormatCheck", +# "weblate.checks.qt.QtPluralCheck", +# "weblate.checks.ruby.RubyFormatCheck", +# "weblate.checks.consistency.PluralsCheck", +# "weblate.checks.consistency.SamePluralsCheck", +# "weblate.checks.consistency.ConsistencyCheck", +# "weblate.checks.consistency.TranslatedCheck", +# "weblate.checks.chars.EscapedNewlineCountingCheck", +# "weblate.checks.chars.NewLineCountCheck", +# "weblate.checks.markup.BBCodeCheck", +# "weblate.checks.chars.ZeroWidthSpaceCheck", +# "weblate.checks.render.MaxSizeCheck", +# "weblate.checks.markup.XMLValidityCheck", +# "weblate.checks.markup.XMLTagsCheck", +# "weblate.checks.markup.MarkdownRefLinkCheck", +# "weblate.checks.markup.MarkdownLinkCheck", +# "weblate.checks.markup.MarkdownSyntaxCheck", +# "weblate.checks.markup.URLCheck", +# "weblate.checks.markup.SafeHTMLCheck", +# "weblate.checks.placeholders.PlaceholderCheck", +# "weblate.checks.placeholders.RegexCheck", +# "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', +# "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.flags.SameEditAddon', +# "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.flags.SameEditAddon", # "weblate.addons.flags.BulkEditAddon", -# 'weblate.addons.generate.GenerateFileAddon', -# 'weblate.addons.json.JSONCustomizeAddon', -# 'weblate.addons.properties.PropertiesSortAddon', -# 'weblate.addons.git.GitSquashAddon', -# 'weblate.addons.removal.RemoveComments', -# 'weblate.addons.removal.RemoveSuggestions', -# 'weblate.addons.resx.ResxUpdateAddon', -# 'weblate.addons.yaml.YAMLCustomizeAddon', -# 'weblate.addons.autotranslate.AutoTranslateAddon', +# "weblate.addons.generate.GenerateFileAddon", +# "weblate.addons.json.JSONCustomizeAddon", +# "weblate.addons.properties.PropertiesSortAddon", +# "weblate.addons.git.GitSquashAddon", +# "weblate.addons.removal.RemoveComments", +# "weblate.addons.removal.RemoveSuggestions", +# "weblate.addons.resx.ResxUpdateAddon", +# "weblate.addons.yaml.YAMLCustomizeAddon", +# "weblate.addons.autotranslate.AutoTranslateAddon", # ) # E-mail address that error messages come from. -SERVER_EMAIL = "weblate@taler.net" +SERVER_EMAIL = 'weblate@taler.net' # Default email address to use for various automated correspondence from # the site managers. Used for registration emails. -DEFAULT_FROM_EMAIL = "weblate@taler.net" +DEFAULT_FROM_EMAIL = 'weblate@taler.net' # List of URLs your site is supposed to serve ALLOWED_HOSTS = ["*"] @@ -746,7 +748,7 @@ CACHES = { "LOCATION": "redis://127.0.0.1:6379/1", # If redis is running on same host as Weblate, you might # want to use unix sockets instead: - # 'LOCATION': 'unix:///var/run/redis/redis.sock?db=1', + # "LOCATION": "unix:///var/run/redis/redis.sock?db=1", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", "PARSER_CLASS": "redis.connection.HiredisParser", @@ -773,9 +775,10 @@ 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" - # Use following with LOGIN_REQUIRED_URLS - # "rest_framework.permissions.IsAuthenticated" + # Require authentication for login required sites + "rest_framework.permissions.IsAuthenticated" + if LOGIN_REQUIRED + else "rest_framework.permissions.IsAuthenticatedOrReadOnly" ], "DEFAULT_AUTHENTICATION_CLASSES": ( "rest_framework.authentication.TokenAuthentication", @@ -794,23 +797,22 @@ REST_FRAMEWORK = { } # Example for restricting access to logged in users -# LOGIN_REQUIRED_URLS = ( -# r'/(.*)$', -# ) +if LOGIN_REQUIRED: + 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 +# rf"{URL_PREFIX}/accounts/(.*)$", # Required for login +# rf"{URL_PREFIX}/admin/login/(.*)$", # Required for admin login +# rf"{URL_PREFIX}/static/(.*)$", # Required for development mode +# rf"{URL_PREFIX}/widgets/(.*)$", # Allowing public access to widgets +# rf"{URL_PREFIX}/data/(.*)$", # Allowing public access to data exports +# rf"{URL_PREFIX}/hooks/(.*)$", # Allowing public access to notification hooks +# rf"{URL_PREFIX}/healthz/$", # Allowing public access to health check +# rf"{URL_PREFIX}/api/(.*)$", # Allowing access to API +# rf"{URL_PREFIX}/js/i18n/$", # JavaScript localization +# rf"{URL_PREFIX}/contact/$", # Optional for contact form +# rf"{URL_PREFIX}/legal/(.*)$", # Optional for legal app # ) # Silence some of the Django system checks @@ -822,7 +824,7 @@ SILENCED_SYSTEM_CHECKS = [ # Celery worker configuration for testing # CELERY_TASK_ALWAYS_EAGER = True -# CELERY_BROKER_URL = 'memory://' +# CELERY_BROKER_URL = "memory://" # CELERY_TASK_EAGER_PROPAGATES = True # Celery worker configuration for production CELERY_TASK_ALWAYS_EAGER = False @@ -850,7 +852,7 @@ DATABASE_BACKUP = "plain" AUTO_UPDATE = False # PGP commits signing -WEBLATE_GPG_IDENTITY = None +WEBLATE_GPG_IDENTITY = 'Weblate <weblate@taler.net>' # Third party services integration MATOMO_SITE_ID = None @@ -863,3 +865,7 @@ AKISMET_API_KEY = None #EMAIL_HOST = 'localhost' EMAIL_HOST_USER = 'weblate' #EMAIL_PORT = '25' + +DEFAULT_COMMITER_NAME = 'Weblate' +DEFAULT_COMMITER_EMAIL = 'weblate@taler.net' +#COMMIT_PENDING_HOURS = 1 |