mirror of
https://github.com/YunoHost-Apps/pyinventory_ynh.git
synced 2024-09-03 20:16:09 +02:00
Use own urls.py to support $YNH_APP_ARG_PATH
This commit is contained in:
parent
aa6c3f7d89
commit
1d13378171
7 changed files with 39 additions and 5 deletions
|
@ -91,7 +91,7 @@ drwxr-xr-x 6 pyinventory pyinventory 6 Dec 8 08:37 venv
|
||||||
root@yunohost:~# cd /opt/yunohost/pyinventory/
|
root@yunohost:~# cd /opt/yunohost/pyinventory/
|
||||||
root@yunohost:/opt/yunohost/pyinventory# source venv/bin/activate
|
root@yunohost:/opt/yunohost/pyinventory# source venv/bin/activate
|
||||||
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py check
|
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py check
|
||||||
PyInventory v0.8.1rc1 (Django v2.2.17)
|
PyInventory v0.8.1rc2 (Django v2.2.17)
|
||||||
DJANGO_SETTINGS_MODULE='ynh_pyinventory_settings'
|
DJANGO_SETTINGS_MODULE='ynh_pyinventory_settings'
|
||||||
PROJECT_PATH:/opt/yunohost/pyinventory/venv/lib/python3.7/site-packages
|
PROJECT_PATH:/opt/yunohost/pyinventory/venv/lib/python3.7/site-packages
|
||||||
BASE_PATH:/opt/yunohost/pyinventory
|
BASE_PATH:/opt/yunohost/pyinventory
|
||||||
|
@ -99,5 +99,7 @@ System check identified no issues (0 silenced).
|
||||||
|
|
||||||
root@yunohost:~# tail -f /var/log/pyinventory/pyinventory.log
|
root@yunohost:~# tail -f /var/log/pyinventory/pyinventory.log
|
||||||
root@yunohost:~# cat /etc/systemd/system/pyinventory.service
|
root@yunohost:~# cat /etc/systemd/system/pyinventory.service
|
||||||
root@yunohost:~# ynh_systemd_action --service_name="pyinventory" --action="restart"
|
|
||||||
|
root@yunohost:~# systemctl reload-or-restart pyinventory
|
||||||
|
root@yunohost:~# journalctl --unit=pyinventory --follow
|
||||||
```
|
```
|
|
@ -28,6 +28,10 @@ assert LOG_FILE.is_file(), f'File not exists: {LOG_FILE}'
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'ynh_urls' # /opt/yunohost/pyinventory/ynh_urls.py
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
ADMINS = (
|
ADMINS = (
|
||||||
('__ADMIN__', '__ADMINMAIL__'),
|
('__ADMIN__', '__ADMINMAIL__'),
|
||||||
)
|
)
|
||||||
|
|
6
conf/ynh_urls.py
Normal file
6
conf/ynh_urls.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.conf.urls import include
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('__PATH_URL__/', include('inventory_project.urls'))
|
||||||
|
]
|
|
@ -5,7 +5,7 @@
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Web based management to catalog things including state and location etc."
|
"en": "Web based management to catalog things including state and location etc."
|
||||||
},
|
},
|
||||||
"version": "0.8.1rc1~ynh2",
|
"version": "0.8.1rc2~ynh1",
|
||||||
"url": "https://github.com/jedie/PyInventory",
|
"url": "https://github.com/jedie/PyInventory",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -31,6 +31,16 @@
|
||||||
},
|
},
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"type": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a path for PyInventory",
|
||||||
|
"fr": "Choisissez un chemin pour PyInventory"
|
||||||
|
},
|
||||||
|
"example": "/pyinventory",
|
||||||
|
"default": "/pyinventory"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/"
|
path_url=$YNH_APP_ARG_PATH
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
@ -28,7 +28,7 @@ pkg_dependencies="build-essential python3-dev python3-pip python3-virtualenv vir
|
||||||
postgresql postgresql-contrib"
|
postgresql postgresql-contrib"
|
||||||
|
|
||||||
# PyInventory's version for PIP and settings file
|
# PyInventory's version for PIP and settings file
|
||||||
pyinventory_version="0.8.1rc1"
|
pyinventory_version="0.8.1rc2"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -125,6 +125,7 @@ cp "../conf/gunicorn.conf.py" "$gunicorn_conf"
|
||||||
ynh_replace_string --match_string="__FINAL_HOME_PATH__" --replace_string="$final_path" --target_file="$gunicorn_conf"
|
ynh_replace_string --match_string="__FINAL_HOME_PATH__" --replace_string="$final_path" --target_file="$gunicorn_conf"
|
||||||
ynh_replace_string --match_string="__LOG_FILE__" --replace_string="$log_file" --target_file="$gunicorn_conf"
|
ynh_replace_string --match_string="__LOG_FILE__" --replace_string="$log_file" --target_file="$gunicorn_conf"
|
||||||
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"
|
||||||
|
|
||||||
cp ../conf/manage.py "$final_path/manage.py"
|
cp ../conf/manage.py "$final_path/manage.py"
|
||||||
chmod +x "$final_path/manage.py"
|
chmod +x "$final_path/manage.py"
|
||||||
|
@ -151,6 +152,11 @@ ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
||||||
|
|
||||||
touch "$final_path/local_settings.py"
|
touch "$final_path/local_settings.py"
|
||||||
|
|
||||||
|
ynh_urls="$final_path/ynh_urls.py"
|
||||||
|
cp "../conf/ynh_urls.py" "$ynh_urls"
|
||||||
|
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$ynh_urls"
|
||||||
|
ynh_store_file_checksum --file="$ynh_urls"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MIGRATE / COLLECTSTATIC / CREATEADMIN
|
# MIGRATE / COLLECTSTATIC / CREATEADMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -140,6 +140,12 @@ ynh_store_file_checksum --file="$settings"
|
||||||
|
|
||||||
touch "$final_path/local_settings.py"
|
touch "$final_path/local_settings.py"
|
||||||
|
|
||||||
|
ynh_urls="$final_path/ynh_urls.py"
|
||||||
|
ynh_backup_if_checksum_is_different --file="$ynh_urls"
|
||||||
|
cp "../conf/ynh_urls.py" "$ynh_urls"
|
||||||
|
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$ynh_urls"
|
||||||
|
ynh_store_file_checksum --file="$ynh_urls"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MIGRATE PYINVENTORY
|
# MIGRATE PYINVENTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue