mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Upgrade weblate to 1.18, remove settings.py and upgrade to python3 because of django 2.0
This commit is contained in:
parent
5d0b16f4cd
commit
3af0b44f7e
8 changed files with 35 additions and 28 deletions
|
@ -20,6 +20,10 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# latest published github
|
||||
upgrade=1 from_commit=5d0b16f4cd458cc5c93f8a3287aa9560738c08fb
|
||||
# latest published in community.json
|
||||
upgrade=1 from_commit=58c98267fa4c3ea5c1ff8fd4c63655a3230a2134
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
incorrect_path=1
|
||||
|
|
|
@ -165,6 +165,9 @@ SECRET_KEY = '__KEY__' # noqa
|
|||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
os.path.join(BASE_DIR, 'templates'),
|
||||
],
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
|
@ -310,7 +313,8 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
]
|
||||
|
||||
# Middleware
|
||||
MIDDLEWARE_CLASSES = (
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
|
@ -321,7 +325,7 @@ MIDDLEWARE_CLASSES = (
|
|||
'social_django.middleware.SocialAuthExceptionMiddleware',
|
||||
'weblate.accounts.middleware.RequireLoginMiddleware',
|
||||
'weblate.middleware.SecurityMiddleware',
|
||||
)
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'weblate.urls'
|
||||
|
||||
|
@ -371,7 +375,10 @@ DEFAULT_EXCEPTION_REPORTER_FILTER = \
|
|||
HAVE_SYSLOG = False
|
||||
if platform.system() != 'Windows':
|
||||
try:
|
||||
SysLogHandler(address='/dev/log', facility=SysLogHandler.LOG_LOCAL2)
|
||||
handler = SysLogHandler(
|
||||
address='/dev/log', facility=SysLogHandler.LOG_LOCAL2
|
||||
)
|
||||
handler.close()
|
||||
HAVE_SYSLOG = True
|
||||
except IOError:
|
||||
HAVE_SYSLOG = False
|
||||
|
@ -560,8 +567,6 @@ 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
|
||||
|
||||
|
@ -577,11 +582,6 @@ LAZY_COMMITS = True
|
|||
# Offload indexing
|
||||
OFFLOAD_INDEXING = True
|
||||
|
||||
# Translation locking
|
||||
AUTO_LOCK = True
|
||||
AUTO_LOCK_TIME = 60
|
||||
LOCK_TIME = 15 * 60
|
||||
|
||||
# Use simple language codes for default language/country combinations
|
||||
SIMPLIFY_LANGUAGES = True
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
[uwsgi]
|
||||
plugins = python
|
||||
plugins = python3
|
||||
master = true
|
||||
protocol = uwsgi
|
||||
socket = /var/run/uwsgi/__APP__.socket
|
||||
virtualenv = __FINALPATH__/venv
|
||||
wsgi-file = __FINALPATH__/venv/lib/python2.7/site-packages/weblate/wsgi.py
|
||||
wsgi-file = __FINALPATH__/venv/lib/python3.4/site-packages/weblate/wsgi.py
|
||||
# Needed for OAuth/OpenID
|
||||
buffer-size = 8192
|
||||
# Increase number of workers for heavily loaded sites
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"description": {
|
||||
"en": "A translation platform using Git and Python"
|
||||
},
|
||||
"version": "2.17.1-1",
|
||||
"version": "2.18-1",
|
||||
"url": "https://weblate.org",
|
||||
"license": "AGPL-3.0",
|
||||
"maintainer": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
current_version="2.17.1"
|
||||
current_version="2.18"
|
||||
|
||||
ynh_check_global_uwsgi_config () {
|
||||
uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency"
|
||||
|
|
|
@ -77,8 +77,8 @@ ynh_app_setting_set "$app" github_token "$github_token"
|
|||
#=================================================
|
||||
|
||||
ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \
|
||||
libjpeg-dev libz-dev libyaml-dev python-dev python-pip python-virtualenv \
|
||||
postgresql libpq-dev uwsgi uwsgi-plugin-python memcached
|
||||
libjpeg-dev libz-dev libyaml-dev python3-dev python3-pip python3-virtualenv python-virtualenv \
|
||||
postgresql libpq-dev uwsgi uwsgi-plugin-python3 memcached
|
||||
|
||||
#=================================================
|
||||
# CREATE A PostgreSQL DATABASE
|
||||
|
@ -182,13 +182,15 @@ ynh_add_uwsgi_service
|
|||
#=================================================
|
||||
# PIP INSTALLATION
|
||||
#=================================================
|
||||
virtualenv "${final_path}/venv"
|
||||
virtualenv --python=python3 "${final_path}/venv"
|
||||
#run source in a 'sub shell'
|
||||
(
|
||||
set +eu
|
||||
set +o nounset
|
||||
source "${final_path}/venv/bin/activate"
|
||||
set -o nounset
|
||||
"${final_path}/venv/bin/pip" install --upgrade pip
|
||||
"${final_path}/venv/bin/pip" install Weblate=="$current_version"
|
||||
"${final_path}/venv/bin/pip" install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns psycopg2 python-memcached
|
||||
"${final_path}/venv/bin/pip" install python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2 python-memcached
|
||||
# specific to YunoHost package:
|
||||
"${final_path}/venv/bin/pip" install django_sendmail_backend
|
||||
)
|
||||
|
@ -202,8 +204,8 @@ db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
|
|||
admin_mail=$(ynh_user_get_info "$admin" mail)
|
||||
key=$(ynh_string_random)
|
||||
memc_port=$(ynh_find_port 8080)
|
||||
settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
||||
cp ../conf/settings.py "$settings"
|
||||
settings="$final_path/venv/lib/python3.4/site-packages/weblate/settings.py"
|
||||
cp "../conf/settings_history/settings.$current_version.py" "$settings"
|
||||
|
||||
weblate_fill_settings "$settings"
|
||||
ynh_app_setting_set "$app" memc_port "$memc_port"
|
||||
|
@ -213,8 +215,9 @@ ynh_app_setting_set "$app" memc_port "$memc_port"
|
|||
# https://docs.weblate.org/en/latest/admin/install.html#filling-up-the-database
|
||||
#==========================================
|
||||
(
|
||||
set +eu
|
||||
set +o nounset
|
||||
source "${final_path}/venv/bin/activate"
|
||||
set -o nounset
|
||||
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
||||
# the user needs to be weblate for postgresql
|
||||
weblate migrate --noinput
|
||||
|
@ -238,7 +241,7 @@ ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app"
|
|||
#=================================================
|
||||
|
||||
# Calculate 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/python3.4/site-packages/weblate/settings.py"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -75,8 +75,8 @@ chown -R "$app": "$final_path"
|
|||
#=================================================
|
||||
|
||||
ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \
|
||||
libjpeg-dev libz-dev libyaml-dev python-dev python-pip python-virtualenv \
|
||||
postgresql libpq-dev uwsgi uwsgi-plugin-python memcached
|
||||
libjpeg-dev libz-dev libyaml-dev python3-dev python3-pip python3-virtualenv \
|
||||
postgresql libpq-dev uwsgi uwsgi-plugin-python3 memcached
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PostgreSQL DATABASE
|
||||
|
|
|
@ -157,7 +157,7 @@ then
|
|||
diff --unified "$old_settings" "$settings" > "$settings_diff"
|
||||
|
||||
# generate new defaults settings
|
||||
cp ../conf/settings.py "$settings"
|
||||
cp "../conf/settings_history/settings.$current_version.py" "$settings"
|
||||
weblate_fill_settings "$settings"
|
||||
|
||||
# send diff to the server administrator
|
||||
|
@ -196,7 +196,7 @@ then
|
|||
else
|
||||
echo "Settings.py was not modified, using the new default file for $current_version."
|
||||
# generate new defaults settings
|
||||
cp ../conf/settings.py "$settings"
|
||||
cp "../conf/settings_history/settings.$current_version.py" "$settings"
|
||||
weblate_fill_settings "$settings"
|
||||
fi
|
||||
|
||||
|
@ -216,7 +216,7 @@ fi
|
|||
)
|
||||
|
||||
# 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/python3.4/site-packages/weblate/settings.py"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
Loading…
Reference in a new issue