安装
Installation in virtualenv
首先以 root
用户登录
This is the recommended method if you don’t want to concern yourself with further detail. This will create a separate Python environment for Weblate, possibly duplicating some of the Python libraries on the system.
1. 开发环境
Install the development files for libraries to be used during the building of the Python modules:
apt install libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev libyaml-dev python3-dev build-essential
2. 虚拟环境
Install pip
and virtualenv
. Usually they are shipped by your distribution or with Python:
apt install python3-pip python3-virtualenv virtualenv
3. 创建虚拟环境
Create and activate virtualenv for Weblate:
virtualenv --python=python3 ~/weblate-env
4. 激活虚拟环境
Activate the virtualenv for Weblate, so Weblate will look for Python libraries there first:
. ~/weblate-env/bin/activate
5. 安装 Weblate
Install Weblate including all dependencies, you can also use pip
to install optional dependencies:
pip install Weblate
# Optional deps
pip install pytz python-bidi PyYAML pyuca
# Install database backend for PostgreSQL
pip install psycopg2-binary
# Install database backend for MySQL
apt install default-libmysqlclient-dev
pip install mysqlclient
6. 创建 配置文件
Create your settings (in this example it would be in~/weblate-env/lib/python3.6/site-packages/weblate/settings.py
based on the settings_example.py
in the same directory).
cp ~/weblate-env/lib/python3.6/site-packages/weblate/settings_example.py
~/weblate-env/lib/python3.6/site-packages/weblate/settings.py
7. 配置
Optionally, adjust the values in the new settings.py
file.
允许访问地址
# List of URLs your site is supposed to serve
ALLOWED_HOSTS = ["67.218.132.50"]
配置 email
我用的是 aliyun 邮箱
企业云邮箱POP\SMTP\IMAP地址和端口信息
找到 SMTP 地址和端口信息
EMAIL_HOST = 'smtp.mxhichina.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'xxxxxxxx'
...
# E-mail address that error messages come from.
SERVER_EMAIL = '[email protected]'
# Default email address to use for various automated correspondence from
# the site managers. Used for registration emails.
DEFAULT_FROM_EMAIL = '[email protected]'
测试发送 email
weblate sendtestemail [email protected]
github 登录
https://github.com/settings/developers
Application name | Virgilio |
---|---|
Homepage URL | http://67.218.132.50 |
Authorization callback URL | http://67.218.132.50/accounts/complete/github/ |
8. 数据库
Create the SQLite database and its structure for Weblate:
weblate migrate
9. 管理员
Create the administrator user account and copy the password it outputs to the clipboard, and maybe also save it to a text file for later use:
weblate createadmin
10. 启动环境
Start the development server:
weblate runserver 67.218.132.50:80 -d
11. 测试
Open a web browser, go to http://67.218.132.50/accounts/login/ and login with the user name admin
and paste the password in.
12. 使用
Proceed with Adding translation to add some translatable contents to your test installation.
You can stop the test server with Ctrl+C, and leave the virtual environment with deactivate
. If you want to resume testing later, you need to repeat the steps 4, 8 and 11 each time to start the development server.
问题
检查
http://67.218.132.50/admin/performance/
发送的邮箱带 example.com
打开 http://67.218.132.50/admin/sites/site/1/
修改 Domain name 域名
Set correct sitename
find . -name "*.md" -print0 | xargs -0 -I M extract M M.zh_Hans.xliff M.zh_Hans.skl en-US zh_Hans
参考
Quick setup guidel
Configuring outgoing email