This specific function is still in the pondering, have the understanding of the great God please say, thank you!
Official documents: HTTPS://DOCS.WEBLATE.ORG/EN/LATEST/ADMIN/INSTALL.HTML#VIRTUALENV
CentOS Installation steps:
Reference Links:
Https://www.chrisyue.com/installation-of-weblate-on-ubuntu.html
Http://www.bubuko.com/infodetail-1964921.html
Development files for libraries used during the building of the Python module:
Yum-y Install libxslt-devel libxml2-devel freetype-devel libjpeg-devel zlib-devel libyaml-devel python-devel
Install Pip and virtualenv. Typically, they are published by your distribution or by Python.
Yum Install Python-pip python-virtualenv
Create and activate virtualenv for weblate
Virtualenv/usr/local/weblate
. /usr/local/weblate/bin/activate
Install the weblate that contains all the dependencies, and you can also use the PIP to install the optional dependency relationship:
Method 1:pip installation (not recommended, because such installation will have several files (manage.py and generate-locales, get the source package inside to find)
Pip Install Weblate
Pip install Pytz python-bidi pyyaml Babel pyuca Pylibravatar Pydns
Method 2:git Clone Source Installation
cd/usr/local/weblate/
git clone https://github.com/nijel/weblate.git
Cd/usr/local/weblate/weblate
Pip Install–r equirements.txt
Pip Install–r requirements-optional.txt
(This in the installation of TESSEROCR when the error, do not go online to find ways, please do yum–y install tesseract*)
Next, configure the database
Install the database and create the library
CREATE DATABASE weblate CHAR SET UTF8;
Cd/usr/local/weblate/weblate/weblate
CP settings_example.py settings.py (Database configuration file)
Data record initialization and initialization of locales, equivalent to importing the default language classification data into the library
Cd/usr/local/weblate/weblate
/usr/local/weblate/weblate/manage.py Migrate
/usr/local/weblate/weblate/scripts/generate-locales
Create an Administrator account password
/usr/local/weblate/weblate/manage.py Createadmin (Running results with account number and password)
Test whether the service can start normally
/usr/local/weblate/weblate/manage.py Runserver (This is the test, in the official service this does not start)
Telnet-i 127.0.0.1:8000 return 200 Normal
Installing the UWSGI Service
Pip Install Uwsgi
Uwsgi--version View Version
Edit Uwsgi configuration file
Vim/etc/uwsgi.ini
[Uwsgi]
# plugins = Python
Master = True
protocol = Uwsgi
Socket = 127.0.0.1:9090
Wsgi-file =/usr/local/weblate/weblate/weblate/wsgi.py
Python-path =/usr/local/weblate/weblate
# Needed for Oauth/openid
Buffer-size = 8192
# Increase number of workers for heavily loaded sites
# workers = 6
# Needed for background processing
Enable-threads = True
#chdir =/usr/local/weblate
#home =/usr/local/weblate
Vhost = True
Pidfile =/var/run/uwsgi9090.pid
Daemonize =/var/log/uwsgi9090.log
Installation Nginx (Installation method yum or source installation)
Yum Installation: Yum-y install Nginx
SOURCE installation: wget-p/usr/local/src/-C http://nginx.org/download/nginx-1.10.3.tar.gz
Tar-xzvf/usr/local/src/nginx-1.10.1.tar.gz-c/usr/local/src/
cd/usr/local/src/nginx-1.10.1
./configure--prefix=/usr/local/nginx--with-http_ssl_module
Make-j 2
Make install
Change the nginxn.conf file
server {
Listen 80;
server_name weblate 10.0.2.145;
Root/usr/local/weblate/weblate/weblate;
Location/favicon.ico {
Alias/usr/local/weblate/weblate/weblate/static/favicon.ico;
Expires 30d;
}
location/static/{
alias/usr/local/weblate/weblate/weblate/static/;
Expires 30d;
}
Location/robots.txt {
Alias/usr/loca/weblate/weblate/weblate/static/robots.txt;
Expires 30d;
}
location/static/admin/{
alias/usr/local/weblate/lib/python2.7/site-packages/django/contrib/admin/static/admin/;
Expires 30d;
}
Location/{
Include Uwsgi_params;
# Needed for long running operations in admin interface
Uwsgi_read_timeout 3600;
Uwsgi_pass 127.0.0.1:9090;
}
Start Uwsgi Uwsgi/etc/uwsgi9090.ini
Start Nginx
Access error:
Solve:
vim/usr/local/weblate/lib/python2.7/site-packages/django/http/request.py
Found: # Allow variants of the localhost if allowed_hosts is empty and debug=true
Add a native IP to
Restart the UWSGI service to
Weblate Online Translator Platform Construction