mirror of
https://github.com/YunoHost-Apps/django-for-runners_ynh.git
synced 2024-09-03 18:26:16 +02:00
update conf+scripts
This commit is contained in:
parent
7b5d642437
commit
c4a0e71ee6
6 changed files with 36 additions and 19 deletions
|
@ -5,8 +5,9 @@ import sys
|
|||
|
||||
|
||||
def main():
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'ynh_for_runners_settings'
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
|
|
8
conf/setup_user.py
Normal file
8
conf/setup_user.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
def setup_project_user(user):
|
||||
"""
|
||||
All users used the Django admin, so we need to set the "staff" user flag.
|
||||
Called from django_ynh.sso_auth
|
||||
"""
|
||||
user.is_staff = True
|
||||
user.save()
|
||||
return user
|
|
@ -2,7 +2,11 @@
|
|||
WSGI config
|
||||
"""
|
||||
import os
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'ynh_for_runners_settings'
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
|
||||
|
||||
from django.core.wsgi import get_wsgi_application # noqa
|
||||
|
||||
|
||||
application = get_wsgi_application()
|
|
@ -116,10 +116,10 @@ fi
|
|||
ynh_script_progression --message="Modify Django-For-Runners's config file..."
|
||||
|
||||
# save old settings file
|
||||
settings="$final_path/ynh_for_runners_settings.py"
|
||||
settings="$final_path/settings.py"
|
||||
ynh_backup_if_checksum_is_different --file="$settings"
|
||||
|
||||
cp "../conf/ynh_for_runners_settings.py" "$settings"
|
||||
cp "../conf/settings.py" "$settings"
|
||||
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$settings"
|
||||
|
|
|
@ -132,10 +132,8 @@ ynh_store_file_checksum --file="$gunicorn_conf"
|
|||
cp ../conf/manage.py "$final_path/manage.py"
|
||||
chmod +x "$final_path/manage.py"
|
||||
|
||||
cp ../conf/wsgi.py "$final_path/wsgi.py"
|
||||
|
||||
settings="$final_path/ynh_for_runners_settings.py"
|
||||
cp "../conf/ynh_for_runners_settings.py" "$settings"
|
||||
settings="$final_path/settings.py"
|
||||
cp "../conf/settings.py" "$settings"
|
||||
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$settings"
|
||||
|
@ -154,9 +152,11 @@ ynh_store_file_checksum --file="$settings"
|
|||
|
||||
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
||||
|
||||
touch "$final_path/local_settings.py"
|
||||
cp ../conf/setup_user.py "$final_path/setup_user.py"
|
||||
cp ../conf/urls.py "$final_path/urls.py"
|
||||
cp ../conf/wsgi.py "$final_path/wsgi.py"
|
||||
|
||||
cp "../conf/ynh_urls.py" "$final_path/ynh_urls.py"
|
||||
touch "$final_path/local_settings.py"
|
||||
|
||||
#=================================================
|
||||
# MIGRATE / COLLECTSTATIC / CREATEADMIN
|
||||
|
|
|
@ -118,14 +118,11 @@ ynh_backup_if_checksum_is_different --file="$final_path/manage.py"
|
|||
cp ../conf/manage.py "$final_path/manage.py"
|
||||
chmod +x "$final_path/manage.py"
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/wsgi.py"
|
||||
cp ../conf/wsgi.py "$final_path/wsgi.py"
|
||||
|
||||
# save old settings file
|
||||
settings="$final_path/ynh_for_runners_settings.py"
|
||||
settings="$final_path/settings.py"
|
||||
ynh_backup_if_checksum_is_different --file="$settings"
|
||||
|
||||
cp "../conf/ynh_for_runners_settings.py" "$settings"
|
||||
cp "../conf/settings.py" "$settings"
|
||||
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$settings"
|
||||
|
@ -142,9 +139,16 @@ ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --
|
|||
# Recalculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$settings"
|
||||
|
||||
touch "$final_path/local_settings.py"
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/setup_user.py"
|
||||
cp ../conf/setup_user.py "$final_path/setup_user.py"
|
||||
|
||||
cp "../conf/ynh_urls.py" "$final_path/ynh_urls.py"
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/urls.py"
|
||||
cp ../conf/urls.py "$final_path/urls.py"
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/wsgi.py"
|
||||
cp ../conf/wsgi.py "$final_path/wsgi.py"
|
||||
|
||||
touch "$final_path/local_settings.py"
|
||||
|
||||
#=================================================
|
||||
# MIGRATE PYINVENTORY
|
||||
|
|
Loading…
Reference in a new issue