升级 Weblate¶
Docker 镜像升级¶
The official Weblate Docker image (see 使用 Docker 安装) integrates all upgrade steps. Typically, no manual interaction is needed beyond pulling the latest (or at least newer) version.
参见
一般的升级指示¶
Always look for new changes to 软件要求 before upgrading.
Once all requirements are installed or upgraded, ensure your
settings.py
matches the changes in the configuration (consult
settings_example.py
for correct values).
Always check Version-specific instructions before upgrading. If you are skipping any version(s), be sure to follow instructions for all versions you are skipping during such upgrade. It’s sometimes better to upgrade gradually to an intermediate version to ensure a smooth migration. Upgrading across multiple releases should work, but is not as well tested as single version upgrades!
备注
Always back up the full database before upgrading, so that you can roll back the database if the upgrade fails, see 备份和移动 Weblate.
Stop the WSGI and Celery processes to avoid old processes running while upgrading. Otherwise incompatible changes in the database might occur.
Upgrade Weblate
对于 pip 安装,可以通过以下命令实现:
pip install -U "Weblate[all]==version"
或者,如果您只想获取最新发布的版本:
pip install -U "Weblate[all]"
如果不想安装所有可选依赖项,请执行以下操作:
pip install -U Weblate
Using Git checkout, you need to fetch new source code and update your installation:
cd weblate-src git pull # Update Weblate inside your virtualenv . ~/weblate-env/bin/pip install -e '.[all]' # Install dependencies directly when not using virtualenv pip install --upgrade -e . # Install optional dependencies directly when not using virtualenv pip install --upgrade -e '.[all]'
New Weblate releases might have new Python 依赖项, check if they cover the features you want.
Upgrade the configuration file by following either
settings_example.py
, or Version-specific instructions.Upgrade the database:
weblate migrate --noinput
收集升级的静态文件(请参见 运行服务器 和 为静态文件提供服务):
weblate collectstatic --noinput --clear
压缩 JavaScript 和 CSS 文件(可选步骤,请参见 压缩客户端资源 ):
weblate compress
If you are running an installation from Git, you should also regenerate locale files every time you upgrade. You can do this by invoking:
weblate compilemessages
验证您的设置合理(还请参见 生产设置):
weblate check --deploy
Restart the Celery worker (see 使用 Celery 的后台任务).
Version-specific instructions¶
在 5.0 版本发生变更: 特定版本的操作指南现在包含在发行日志中,见 Weblate 5.7。
从较旧的大版本进行升级¶
不支持跨大版本的升级。始终先升级到初始大版本的最新补丁级别。跳过此步骤进行升级不受支持,并且会搞砸升级。
如果从 2.x 发布版本升级,请始终先升级到 3.0.1。
如果从 3.x 发布版本升级,请始终首先升级到 4.0.4。
如果从 4.x 发布版本升级,请首先升级到 5.0.2。
从其它数据库迁移到 PostgreSQL¶
If you are not running Weblate with a different database than PostgreSQL, consider migrating to PostgreSQL for better performance by doing the following steps. Remember to stop both, the web and Celery servers beforehand, otherwise you might end up with inconsistent data.
创建 PostgreSQL 数据库¶
It is usually a good idea to run Weblate in a separate database, and a separate user account:
# If PostgreSQL was not installed before, set the main password
sudo -u postgres psql postgres -c "\password postgres"
# Create a database user called "weblate"
sudo -u postgres createuser -D -P weblate
# Create the database "weblate" owned by "weblate"
sudo -u postgres createdb -E UTF8 -O weblate weblate
使用 pgloader 迁移到 PostgreSQL¶
The pgloader is a generic migration tool to migrate data to PostgreSQL. You can use it to migrate your Weblate database.
Adjust your
settings.py
to use PostgreSQL as database.迁移 PostgreSQL 中的模式:
weblate migrate weblate sqlflush | weblate dbshell
3. Run the pgloader to transfer the data. The following script can be used to migrate the database, but you might want to learn more about pgloader to better understand what it does, and tweak it to match your setup:
LOAD DATABASE FROM mysql://weblate:password@localhost/weblate INTO postgresql://weblate:password@localhost/weblate WITH include no drop, truncate, create no tables, create no indexes, no foreign keys, disable triggers, reset sequences, data only ALTER SCHEMA 'weblate' RENAME TO 'public' ;
从 Pootle 迁移¶
As Weblate was originally written as a replacement for Pootle, it is supported
to migrate the user accounts from it. You can dump the users from Pootle and
import them using importusers
.