mirror of
https://github.com/YunoHost-Apps/django-fritzconnection_ynh.git
synced 2024-09-03 18:26:24 +02:00
Add config to change settings.DEBUG
This commit is contained in:
parent
7f3a3c466e
commit
4ea25646c7
8 changed files with 50 additions and 8 deletions
8
conf/local_settings.py
Normal file
8
conf/local_settings.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
"""
|
||||
Here it's possible to overwrite everything in settings.py
|
||||
|
||||
Note:
|
||||
Used for YunoHost config and will be **overwritten** on every config change!
|
||||
"""
|
||||
|
||||
DEBUG = __DJANGO_DEBUG__ # Don't turn DEBUG on in production!
|
|
@ -13,11 +13,10 @@ from pathlib import Path as __Path
|
|||
|
||||
from django_yunohost_integration.base_settings import * # noqa
|
||||
from django_yunohost_integration.secret_key import get_or_create_secret as __get_or_create_secret
|
||||
|
||||
from djfritz_project.settings.base import * # noqa
|
||||
|
||||
|
||||
DEBUG = False # Don't turn DEBUG on in production!
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
FINAL_HOME_PATH = __Path('__FINAL_HOME_PATH__') # /opt/yunohost/$app
|
||||
|
|
20
config_panel.toml
Normal file
20
config_panel.toml
Normal file
|
@ -0,0 +1,20 @@
|
|||
# https://github.com/YunoHost/example_ynh/blob/master/config_panel.toml.example
|
||||
|
||||
version = "1.0"
|
||||
|
||||
[main]
|
||||
name = "Settings"
|
||||
|
||||
[main.djfritz_config]
|
||||
name = "django-fritzconnection configuration"
|
||||
|
||||
# Trigger a service reload-or-restart after the user change a question in this panel
|
||||
services = ["__APP__"]
|
||||
|
||||
[main.djfritz_config.django_debug]
|
||||
ask = "debug mode"
|
||||
help = "Important: Never activate this settings.DEBUG on production!"
|
||||
type = "boolean"
|
||||
yes = "True"
|
||||
no = "False"
|
||||
bind = "DJANGO_DEBUG:/opt/yunohost/__APP__/local_settings.py"
|
|
@ -19,7 +19,7 @@
|
|||
},
|
||||
"previous_maintainers": [],
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.0"
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -41,6 +41,6 @@
|
|||
"name": "admin",
|
||||
"type": "user"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ final_path=/opt/yunohost/$app
|
|||
log_path=/var/log/$app
|
||||
log_file="${log_path}/django-fritzconnection.log"
|
||||
|
||||
# Default: settings.DEBUG=False
|
||||
django_debug="False"
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
|
|
@ -57,6 +57,9 @@ db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
|||
admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
|
||||
redis_db=$(ynh_redis_get_free_db)
|
||||
|
||||
# Always deactivate settings.DEBUG:
|
||||
ynh_app_setting_set --app=$app --key=django_debug --value="0"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
@ -164,7 +167,7 @@ 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"
|
||||
|
||||
touch "$final_path/local_settings.py"
|
||||
ynh_add_config --template="local_settings.py" --destination="$final_path/local_settings.py"
|
||||
|
||||
#=================================================
|
||||
# MIGRATE / COLLECTSTATIC / CREATEADMIN
|
||||
|
|
|
@ -55,8 +55,6 @@ ynh_script_progression --message="Restoring the app main directory..."
|
|||
ynh_restore_file --origin_path="$public_path"
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
touch "$final_path/local_settings.py"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
|
|
@ -29,6 +29,8 @@ db_user=$db_name
|
|||
admin_mail=$(ynh_user_get_info "$admin" mail)
|
||||
redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db)
|
||||
|
||||
django_debug=$(ynh_app_setting_get --app="$app" --key=django_debug)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -52,6 +54,13 @@ ynh_script_progression --message="Stopping systemd services..." --weight=5
|
|||
|
||||
ynh_systemd_action --service_name="$app" --action="stop"
|
||||
|
||||
#=================================================
|
||||
# Manage old settings
|
||||
#=================================================
|
||||
|
||||
# Always deactivate settings.DEBUG:
|
||||
ynh_app_setting_set --app=$app --key=django_debug --value="0"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -159,7 +168,9 @@ 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"
|
||||
# Regenerate a fresh local_settings:
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/local_settings.py"
|
||||
ynh_add_config --template="local_settings.py" --destination="$final_path/local_settings.py"
|
||||
|
||||
#=================================================
|
||||
# MIGRATE PYINVENTORY
|
||||
|
|
Loading…
Reference in a new issue