1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

using PIP because django package is too old

This commit is contained in:
Jean-Baptiste Holcroft 2017-09-14 14:11:48 +02:00
parent 87de11d74c
commit 82b354400d
3 changed files with 33 additions and 25 deletions

View file

@ -1,9 +1,9 @@
# https://docs.weblate.org/en/latest/admin/install.html#production-cron # https://docs.weblate.org/en/latest/admin/install.html#production-cron
# Fulltext index updates # Fulltext index updates
10 * * * * www-data cd "__FINALPATH__" && python3 ./manage.py update_index 10 * * * * www-data cd "__FINALPATH__" && source __FINALPATH__/venv/bin/activate && python3 ./manage.py update_index
# Cleanup stale objects # Cleanup stale objects
@daily cd "__FINALPATH__" && ./manage.py cleanuptrans @daily cd "__FINALPATH__" && source __FINALPATH__/venv/bin/activate && ./manage.py cleanuptrans
# Commit pending changes after 96 hours # Commit pending changes after 96 hours
@hourly cd "__FINALPATH__" && ./manage.py commit_pending --all --age=96 --verbosity=0 @hourly cd "__FINALPATH__" && source __FINALPATH__/venv/bin/activate && ./manage.py commit_pending --all --age=96 --verbosity=0

View file

@ -2,6 +2,9 @@
uid = __NAME__ uid = __NAME__
gid = users gid = users
# the virtualenv (full path)
home = __FINALPATH__/venv
protocol = uwsgi protocol = uwsgi
wsgi-file = __FINALPATH__/weblate/wsgi.py wsgi-file = __FINALPATH__/weblate/wsgi.py
python-path = __FINALPATH__ python-path = __FINALPATH__
@ -28,4 +31,4 @@ chmod-socket = 666
stats = /opt/__NAME__/stats.sock stats = /opt/__NAME__/stats.sock
# clear environment on exit # clear environment on exit
vacuum = true vacuum = true
plugins = python3 plugins = python

View file

@ -69,12 +69,8 @@ ynh_app_setting_set $app is_public $is_public
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_install_app_dependencies python-django translate-toolkit \ ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \
python-whoosh python-pil python-libravatar \ libjpeg-dev libz-dev libyaml-dev python-dev python-pip python-virtualenv
python-babel git mercurial \
python-django-compressor python-django-crispy-forms \
python-djangorestframework python-dateutil \
uwsgi uwsgi-plugin-python
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
@ -97,6 +93,14 @@ ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_setup_source "$final_path"
#=================================================
# PIP INSTALLATION
#=================================================
sudo su $app -c "virtualenv ${final_path}/venv"
sudo source ${final_path}/venv/bin/activate
sudo pip install Weblate
sudo pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -130,6 +134,7 @@ sudo cp ../conf/uwsgi_service /etc/systemd/system/$app.uwsgi.service
ynh_replace_string "__NAME__" "$app" /etc/systemd/system/$app.uwsgi.service ynh_replace_string "__NAME__" "$app" /etc/systemd/system/$app.uwsgi.service
ynh_replace_string "__FINALPATH__" "$final_path" /etc/systemd/system/$app.uwsgi.service ynh_replace_string "__FINALPATH__" "$final_path" /etc/systemd/system/$app.uwsgi.service
# Start service # Start service
sudo systemctl enable $app.uwsgi.service sudo systemctl enable $app.uwsgi.service
sudo systemctl restart $app.uwsgi.service sudo systemctl restart $app.uwsgi.service
@ -149,7 +154,7 @@ key=$(ynh_string_random 64)
sudo cp $final_path/weblate/settings_example.py $final_path/weblate/settings.py sudo cp $final_path/weblate/settings_example.py $final_path/weblate/settings.py
sudo cp ../conf/settings.py $final_path/weblate/settings.py sudo cp ../conf/settings.py $final_path/weblate/settings.py
ynh_replace_string "__NAME__" "$app" $final_path/settings.py ynh_replace_string "__NAME__" "$app" $final_path/weblate/settings.py
ynh_replace_string "__DB_PWD__" "$db_pwd" $final_path/weblate/settings.py ynh_replace_string "__DB_PWD__" "$db_pwd" $final_path/weblate/settings.py
ynh_replace_string "__ADMIN__" "$admin" $final_path/weblate/settings.py ynh_replace_string "__ADMIN__" "$admin" $final_path/weblate/settings.py
ynh_replace_string "__ADMINMAIL__" "$admin_mail" $final_path/weblate/settings.py ynh_replace_string "__ADMINMAIL__" "$admin_mail" $final_path/weblate/settings.py
@ -171,7 +176,7 @@ sudo $final_path/manage.py collectstatic --noinput
# SETUP CRON # SETUP CRON
#================================================= #=================================================
cp ../conf/cron_weblate /etc/cron.d/$app sudo cp ../conf/cron_weblate /etc/cron.d/$app
ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app
#================================================= #=================================================
@ -188,7 +193,7 @@ ynh_store_file_checksum "$final_path/CONFIG_FILE"
#================================================= #=================================================
# Set permissions to app files # Set permissions to app files
chown -R root: $final_path sudo chown -R root: $final_path
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE