mirror of
https://github.com/YunoHost-Apps/django-for-runners_ynh.git
synced 2024-09-03 18:26:16 +02:00
Set manage.py shebang to the own venv interpreter
so it's directly callable without activated venv!
This commit is contained in:
parent
e875185a31
commit
1a93d38e0c
3 changed files with 27 additions and 32 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!__FINAL_HOME_PATH__/venv/bin/python
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -134,6 +134,8 @@ ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_f
|
||||||
ynh_store_file_checksum --file="$gunicorn_conf"
|
ynh_store_file_checksum --file="$gunicorn_conf"
|
||||||
|
|
||||||
cp ../conf/manage.py "$final_path/manage.py"
|
cp ../conf/manage.py "$final_path/manage.py"
|
||||||
|
ynh_replace_string --match_string="__FINAL_HOME_PATH__" --replace_string="$final_path" --target_file="$final_path/manage.py"
|
||||||
|
ynh_store_file_checksum --file="$final_path/manage.py"
|
||||||
chmod +x "$final_path/manage.py"
|
chmod +x "$final_path/manage.py"
|
||||||
|
|
||||||
settings="$final_path/settings.py"
|
settings="$final_path/settings.py"
|
||||||
|
@ -169,25 +171,21 @@ touch "$final_path/local_settings.py"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10
|
ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10
|
||||||
|
|
||||||
(
|
cd "$final_path" || exit
|
||||||
set +o nounset
|
|
||||||
source "${final_path}/venv/bin/activate"
|
|
||||||
set -o nounset
|
|
||||||
cd "${final_path}"
|
|
||||||
|
|
||||||
# Just for debugging:
|
# Just for debugging:
|
||||||
./manage.py diffsettings
|
./manage.py diffsettings
|
||||||
|
|
||||||
./manage.py migrate --no-input
|
./manage.py migrate --no-input
|
||||||
./manage.py collectstatic --no-input
|
./manage.py collectstatic --no-input
|
||||||
|
|
||||||
# Create/update Django superuser (set unusable password, because auth done via SSOwat):
|
# Create/update Django superuser (set unusable password, because auth done via SSOwat):
|
||||||
./manage.py create_superuser --username="$admin" --email="$admin_mail"
|
./manage.py create_superuser --username="$admin" --email="$admin_mail"
|
||||||
|
|
||||||
|
# Check the configuration
|
||||||
|
# This may fail in some cases with errors, etc., but the app works and the user can fix issues later.
|
||||||
|
./manage.py check --deploy || true
|
||||||
|
|
||||||
# Check the configuration
|
|
||||||
# This may fail in some cases with errors, etc., but the app works and the user can fix issues later.
|
|
||||||
./manage.py check --deploy || true
|
|
||||||
)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
|
|
@ -118,8 +118,9 @@ ynh_replace_string --match_string="__LOG_FILE__" --replace_string="$log_file" --
|
||||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$gunicorn_conf"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$gunicorn_conf"
|
||||||
ynh_store_file_checksum --file="$gunicorn_conf"
|
ynh_store_file_checksum --file="$gunicorn_conf"
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different --file="$final_path/manage.py"
|
|
||||||
cp ../conf/manage.py "$final_path/manage.py"
|
cp ../conf/manage.py "$final_path/manage.py"
|
||||||
|
ynh_replace_string --match_string="__FINAL_HOME_PATH__" --replace_string="$final_path" --target_file="$final_path/manage.py"
|
||||||
|
ynh_store_file_checksum --file="$final_path/manage.py"
|
||||||
chmod +x "$final_path/manage.py"
|
chmod +x "$final_path/manage.py"
|
||||||
|
|
||||||
# save old settings file
|
# save old settings file
|
||||||
|
@ -161,25 +162,21 @@ touch "$final_path/local_settings.py"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10
|
ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10
|
||||||
|
|
||||||
(
|
cd "$final_path" || exit
|
||||||
set +o nounset
|
|
||||||
source "${final_path}/venv/bin/activate"
|
|
||||||
set -o nounset
|
|
||||||
cd "${final_path}"
|
|
||||||
|
|
||||||
# Just for debugging:
|
# Just for debugging:
|
||||||
./manage.py diffsettings
|
./manage.py diffsettings
|
||||||
|
|
||||||
./manage.py migrate --no-input
|
./manage.py migrate --no-input
|
||||||
./manage.py collectstatic --no-input
|
./manage.py collectstatic --no-input
|
||||||
|
|
||||||
# Create/update Django superuser (set unusable password, because auth done via SSOwat):
|
# Create/update Django superuser (set unusable password, because auth done via SSOwat):
|
||||||
./manage.py create_superuser --username="$admin" --email="$admin_mail"
|
./manage.py create_superuser --username="$admin" --email="$admin_mail"
|
||||||
|
|
||||||
|
# Check the configuration
|
||||||
|
# This may fail in some cases with errors, etc., but the app works and the user can fix issues later.
|
||||||
|
./manage.py check --deploy || true
|
||||||
|
|
||||||
# Check the configuration
|
|
||||||
# This may fail in some cases with errors, etc., but the app works and the user can fix issues later.
|
|
||||||
./manage.py check --deploy || true
|
|
||||||
)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
|
Loading…
Reference in a new issue