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 | |
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')
-rw-r--r-- | weblate/NOTES | 23 | ||||
-rw-r--r-- | weblate/SETUP-NOTES.md | 149 | ||||
-rw-r--r-- | weblate/settings.py | 318 |
3 files changed, 185 insertions, 305 deletions
diff --git a/weblate/NOTES b/weblate/NOTES new file mode 100644 index 0000000..70bad6b --- /dev/null +++ b/weblate/NOTES @@ -0,0 +1,23 @@ +For detailed information, checkout deployment.git/weblate + +Quick notes about this configuration: + +- weekly cron job runs ~/weblateBackup.sh + +- activate virtualenv: + . ~/weblate-env/bin/activate + +- `~/celery-weblate` is required by celery-weblate systemd service: https://docs.weblate.org/en/latest/admin/install.html#running-celery-as-system-service + +- `settings.py` symlink in /home/weblate goes to the active copy + +- Running celery-weblate as a systemd service with local user prvs: + systemd --user start |stop | status celery-weblate + +- Running uswgi as systemd service with local user privs. + +- Local systemd files belong in /home/weblate/.config/systemd/user + +- `DATA_DIR` symlink is referenced in nginx config. Should point to ~/weblate-env/lib/python3.8/site-packages/data + +- `webroot` ymlinks referenced in nginx config. At this time, I don't know what this should point to locally. It is the equivalent of /usr/shre/weblate if not running in virtualenv (see nginx config: ) diff --git a/weblate/SETUP-NOTES.md b/weblate/SETUP-NOTES.md deleted file mode 100644 index b5e11fa..0000000 --- a/weblate/SETUP-NOTES.md +++ /dev/null @@ -1,149 +0,0 @@ -## Weblate.taler.net Setup Notes - -### The purpose of this is to document how the weblate.taler.net service was built, in the event that it needs to be repaired, changed, reproduced, etc. - -Always refer to https://docs.weblate.org/ if necessary, or just for a good laugh. - -### Upgrading - -See latest recommendations: -https://docs.weblate.org/en/latest/admin/upgrade.html?highlight=upgrade#generic-upgrade-instructions - -Current process: - -``` -$ . ~/weblate-env/bin/activate - -$ systemctl --user stop celery-weblate - -$ systemctl --user stop uwsgi-weblate - -$ pip install -U Weblate - -$ maybe re-build settings.py from ~/weblate-env/lib/python3.8/site-packages/weblate/settings_example.py - -$ weblate collectstatic --noinput - -$ weblate check --deploy -``` - -### Basic structure: - -This weblate instance runs as a python3 virtualenv under non-priv `/home/weblate`. - -The generic instructions used to build the site are here, and were followed closely: -https://docs.weblate.org/en/latest/admin/install/venv-debian.html - -#### Notes on general installation: - -* settings document is in `~/weblate-env/lib/python3.8/site-packages/weblate/settings.py` (see symlink in ~) (backup copy in `.`) -* "data directory" or "DATA_DIR" is `~/weblate-env/lib/python3.8/site-packages/data/` (see symlink to `DATA_DIR/` in ~) -* virtualenv is invoked anytime with `. ~/weblate-env/bin/activate`. This activates the weblate path to access weblate binaries without full paths. - -### Configuration - -#### `/home/weblate` shell account - - non-priv user with access via SSH key - celery and uwsgi services run under this user (see *systemd* below) - -#### postgres - - configured for `localhost` access only (ie - `$ psql`) - no password - Unix `weblate` user has full control over psql 'weblate' user - Must manually create 'weblate' database - DB Credentials added to `settings.py` "DATABASES" section - -Do this: - `psql=> CREATE EXTENSION pg_trgm;`` - -#### e-mail - - weblate@taler.net - * no password - * available via localhost using SMTP - * info added to `settings.py` in Django format: - `EMAIL_HOST_USER = 'weblate'` - (`EMAIL_HOST` and `EMAIL_PORT` not required re: defaults to localhost and 25) - * Test E-mail from `/home/weblate`: - - ``` - # telnet localhost 25 - Trying 127.0.0.1... - Connected to localhost. - Escape character is '^]'. - 220 gv.taler.net ESMTP Postfix - HELO localhost - 250 gv.taler.net - MAIL From: weblate@taler.net - 250 2.1.0 Ok - RCPT To: weblate@gnunet.org - 250 2.1.5 Ok - DATA - 354 End data with <CR><LF>.<CR><LF> - hello - . - 250 2.0.0 Ok: queued as xxxxx - quit - 221 2.0.0 Bye - Connection closed by foreign host. - ``` - -#### Python modules - -From https://docs.weblate.org/en/latest/admin/install/venv-debian.html#python-modules - -All-day modules installed: - -`$ pip install Weblate aeidon psycopg2-binary` - -#### nginx - -This root-level service can be found in the `root` repository. - -#### uwsgi - -uwsgi: https://docs.weblate.org/en/latest/admin/install.html?highlight=uwsgi#sample-configuration-for-nginx-and-uwsgi - -See **systemd** below for customization information. - -#### celery - -Celery: https://docs.weblate.org/en/latest/admin/install.html#celery - -See **systemd** below for customization information. - -#### systemd - -Our needs require running weblate under `weblate` user as a non-priv service. This requires running celery-weblate and uwsgi-weblate services as user-level systemd services. - -* See service files under `systemd-nonpriv/` in this repo. -* On server, non-priv `systemd` files live in `/home/weblate/.config/systemd/user/` -* Commands: - `$ systemctl --user enable | disable | start | stop | status *servicename*` - -#### rollbar - -For error collection: https://docs.weblate.org/en/weblate-4.0.2/admin/install.html#collecting-errors - -(in virtualenv): `$ pip install rollbar` - - - -### Running Weblate - -After installing and customizing, log into `weblate` shell account, and invoke virtualenv: - -`$ . ~/weblate-env/bin/activate` - -Now run Django static files collection (required once): -(https://docs.weblate.org/en/latest/admin/install.html?highlight=uwsgi#serving-static-files) - -`$ weblate collectstatic --noinput` - -Weblate server should now be set up and visible at the location specified in the nginx `weblate.site` file. If the site is visible but looks like it's missing CSS styles, that's a problem with the static files. Common causes: - -* static files were not collected -* nginx is not pointing to the correct location - * maybe the `/home/weblate/DATA_DIR` symlink is broken? 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 |