首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Ubuntu安装Weblate

Ubuntu安装Weblate

作者头像
iOSDevLog
发布2019-04-01 10:03:42
发布2019-04-01 10:03:42
1.1K0
举报
文章被收录于专栏:iOSDevLogiOSDevLog

安装


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:

代码语言:javascript
复制
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:

代码语言:javascript
复制
apt install python3-pip python3-virtualenv virtualenv

3. 创建虚拟环境

Create and activate virtualenv for Weblate:

代码语言:javascript
复制
virtualenv --python=python3 ~/weblate-env

4. 激活虚拟环境

Activate the virtualenv for Weblate, so Weblate will look for Python libraries there first:

代码语言:javascript
复制
. ~/weblate-env/bin/activate

5. 安装 Weblate

Install Weblate including all dependencies, you can also use pip to install optional dependencies:

代码语言:javascript
复制
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).

代码语言:javascript
复制
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.

允许访问地址

代码语言:javascript
复制
# List of URLs your site is supposed to serve
ALLOWED_HOSTS = ["67.218.132.50"]

配置 email

我用的是 aliyun 邮箱

企业云邮箱POP\SMTP\IMAP地址和端口信息

找到 SMTP 地址和端口信息

代码语言:javascript
复制
EMAIL_HOST = 'smtp.mxhichina.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'xxx@xxx.com'
EMAIL_HOST_PASSWORD = 'xxxxxxxx'
...

 # E-mail address that error messages come from.
SERVER_EMAIL = 'iosdevlog@iosdevlog.com'
                                                                                                                                                                                                                                                                                               # Default email address to use for various automated correspondence from
# the site managers. Used for registration emails. 
DEFAULT_FROM_EMAIL = 'iosdevlog@iosdevlog.com'

测试发送 email

代码语言:javascript
复制
weblate sendtestemail xxx@xxx.com

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:

代码语言:javascript
复制
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:

代码语言:javascript
复制
weblate createadmin

10. 启动环境

Start the development server:

代码语言:javascript
复制
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

代码语言:javascript
复制
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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019.03.28 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装
    • 1. 开发环境
    • 2. 虚拟环境
    • 3. 创建虚拟环境
    • 4. 激活虚拟环境
    • 5. 安装 Weblate
    • 6. 创建 配置文件
    • 7. 配置
    • 8. 数据库
    • 9. 管理员
    • 10. 启动环境
    • 11. 测试
    • 12. 使用
  • 问题
    • 检查
    • 发送的邮箱带 example.com
  • 参考
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档