升級 Weblate¶
Docker 映像升級¶
官方 Weblate Docker 映像(請參閱 使用 Docker 安裝)整合了所有升級步驟。通常無需除拉取最新(或至少較新)版本之外的人工互動。
也參考
通用升級說明¶
升級前,請始終檢查 軟體需求 的新變更。安裝或升級所有的必需項後,請確保您的 settings.py 相符設定中的變更(正確的值請見 settings_example.py)。
在升級前務必查看 版本特定說明。在您略過一些版本的情況下,請務必遵從在升級中您所略過的所有版本的說明。有時最好升級到一些中間版本以確保順利移轉。跨多個發行版本的升級應該可行,但還沒有像單一版本升級一樣經過充分測試!
備註
請在升級前始終備份完整資料庫,以便您可以在升級失敗的情況下回復資料庫,參閱 備份和移動 Weblate。
請等待 Celery 佇列變空,然後停止 WSGI 和 Celery 處理程序避免升級時舊處理程序執行。否則可能發生不相容的資料庫變更。
Celery 任務佇列不是跨版本的穩定介面,因此不保證來自舊版本的佇列任務在升級後能正常工作。可以在 管理介面 中監控佇列長度或使用
celery_queues來監控佇列長度。升級 Weblate
對於 pip 安裝,可以通過後面的來達成:
uv pip install -U "weblate[all]==version"
或者,如果您只想取得最新發佈的版本:
uv pip install -U "weblate[all]"
如果不想安裝所有選用相依套件,請執行以下操作:
uv pip install -U weblate
使用 Git checkout,您需要取回新的原始碼並更新您的安裝:
cd weblate-src git pull # Update Weblate inside your Python environment . ~/weblate-env/bin/uv pip install -e '.[all]' # Install dependencies directly when not using Python environment uv pip install --upgrade -e . # Install optional dependencies directly when not using a Python environment uv pip install --upgrade -e '.[all]'
新的 Weblate 發行版本可能加入新的 Python 相依套件,請確認其中是否包含您需要的功能。
升級設定檔案,所需的步驟請參考
settings_example.py或 版本特定說明。升級資料庫:
weblate migrate --noinput
收集升級的靜態檔案(請參閱 執行伺服器 和 提供靜態檔案):
weblate collectstatic --noinput
如果執行的是從 Git 安裝的版本,每次升級時也應重新產生語系檔案。請執行:
weblate compilemessages驗證您的設定是否合理 (另請參閱 生產設定):
weblate check --deploy
重新啟動 Celery worker (請參閱 使用 Celery 的背景工作)。
部分升級會使用定期 Celery 工作,在背景執行翻譯記憶作用範圍回填及整併。升級後請讓 Celery 保持執行,並在 管理 > 效能報告 中監看進度。詳細資訊請參閱 翻譯記憶範圍。
版本特定說明¶
在 5.0 版的變更: 特定版本的操作指南現在包含在發行日志中,見 Weblate 2026.8。
從較舊的不受支援的版本進行升級¶
只支援來自目前或上個日曆年的版本進行直接升級。如果您需要跨越這個邊界進行升級,請先升級到下方所列的中間版本。不支援跳過這一步進行升級,這樣升級會出問題。
如果從 2.x 釋出版本升級,請始終先升級到 3.0.1。
如果從 3.x 釋出版本升級,請始終首先升級到 4.0.4。
如果從 4.x 釋出版本升級,請首先升級到 5.0.2。
如果從 5.0.x-5.9.x 升級,請始終先升級到 5.10.4。
目前直接支援從 5.10.x 和更新版本進行升級。
從其它資料庫移轉到 PostgreSQL¶
警告
Weblate 不再支援 MySQL 與 MariaDB。您必須先移轉至 PostgreSQL 再升級。
如果您目前使用 MySQL 或 MariaDB 執行 Weblate,請考慮執行以下步驟移轉到 PostgreSQL,因為 Weblate 與它搭配效能更好。請記住移轉前要停止 Web 和 Celery 伺服器,否則會導致不一致的資料。
建立 PostgreSQL資料庫¶
通常來說,用單獨的資料庫中和單獨的使用者帳號執行 Weblate 是個好主意:
# 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¶
pgloader 是通用移轉工具,將資料移轉到 PostgreSQL。您可以使用它來移轉您的 Weblate 資料庫。
調整您的
settings.py以使用 PostgreSQL 作為資料庫。移轉 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 移轉¶
由於 Weblate 最初是作為 Pootle 的替代品而編寫的,因此支援從 Pootle 移轉使用者帳號。您可以從 Pootle 轉儲使用者,並使用 importusers 將其匯入。