mirror of
https://github.com/YunoHost-Apps/pyinventory_ynh.git
synced 2024-09-03 20:16:09 +02:00
commit
bc958a802b
7 changed files with 55 additions and 11 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:/opt/yunohost/pyinventory# source venv/bin/activate
|
||||
(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'
|
||||
PROJECT_PATH:/opt/yunohost/pyinventory/venv/lib/python3.7/site-packages
|
||||
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:~# 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
|
||||
```
|
|
@ -17,15 +17,22 @@ DEBUG = False
|
|||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
FINAL_HOME_PATH = __Path('__FINAL_HOME_PATH__')
|
||||
FINAL_HOME_PATH = __Path('__FINAL_HOME_PATH__') # /opt/yunohost/$app
|
||||
assert FINAL_HOME_PATH.is_dir(), f'Directory not exists: {FINAL_HOME_PATH}'
|
||||
|
||||
FINAL_WWW_PATH = __Path('__FINAL_WWW_PATH__')
|
||||
FINAL_WWW_PATH = __Path('__FINAL_WWW_PATH__') # /var/www/$app
|
||||
assert FINAL_WWW_PATH.is_dir(), f'Directory not exists: {FINAL_WWW_PATH}'
|
||||
|
||||
LOG_FILE = __Path('__LOG_FILE__')
|
||||
LOG_FILE = __Path('__LOG_FILE__') # /var/log/$app//pyinventory.log
|
||||
assert LOG_FILE.is_file(), f'File not exists: {LOG_FILE}'
|
||||
|
||||
PATH_URL = '__PATH_URL__' # $YNH_APP_ARG_PATH
|
||||
PATH_URL = PATH_URL.strip('/')
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
ROOT_URLCONF = 'ynh_urls' # /opt/yunohost/pyinventory/ynh_urls.py
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
ADMINS = (
|
||||
|
@ -88,12 +95,18 @@ CACHES = {
|
|||
# _____________________________________________________________________________
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = str(FINAL_WWW_PATH / 'static')
|
||||
if PATH_URL:
|
||||
STATIC_URL = f'/{PATH_URL}/static/'
|
||||
MEDIA_URL = f'/{PATH_URL}/media/'
|
||||
else:
|
||||
# Installed to domain root, without a path prefix?
|
||||
STATIC_URL = '/static/'
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
STATIC_ROOT = str(FINAL_WWW_PATH / 'static')
|
||||
MEDIA_ROOT = str(FINAL_WWW_PATH / 'media')
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
LOGGING = {
|
||||
|
|
12
conf/ynh_urls.py
Normal file
12
conf/ynh_urls.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from django.conf import settings
|
||||
from django.conf.urls import include
|
||||
from django.urls import path
|
||||
|
||||
# settings.PATH_URL is the $YNH_APP_ARG_PATH
|
||||
if settings.PATH_URL:
|
||||
urlpatterns = [
|
||||
path(f'{settings.PATH_URL}/', include('inventory_project.urls'))
|
||||
]
|
||||
else:
|
||||
# Installed to domain root, without a path prefix?
|
||||
from inventory_project.urls import urlpatterns # noqa
|
|
@ -5,7 +5,7 @@
|
|||
"description": {
|
||||
"en": "Web based management to catalog things including state and location etc."
|
||||
},
|
||||
"version": "0.8.1rc1~ynh2",
|
||||
"version": "0.8.1rc3~ynh1",
|
||||
"url": "https://github.com/jedie/PyInventory",
|
||||
"license": "GPL-3.0",
|
||||
"maintainer": {
|
||||
|
@ -31,6 +31,16 @@
|
|||
},
|
||||
"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",
|
||||
"type": "user",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
@ -28,7 +28,7 @@ pkg_dependencies="build-essential python3-dev python3-pip python3-virtualenv vir
|
|||
postgresql postgresql-contrib"
|
||||
|
||||
# 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="__LOG_FILE__" --replace_string="$log_file" --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"
|
||||
chmod +x "$final_path/manage.py"
|
||||
|
@ -141,6 +142,7 @@ ynh_replace_string --match_string="__ADMINMAIL__" --replace_string="$admin_mail"
|
|||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__FINAL_HOME_PATH__" --replace_string="$final_path" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__FINAL_WWW_PATH__" --replace_string="$public_path" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__LOG_FILE__" --replace_string="$log_file" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__REDIS_DB__" --replace_string="$redis_db" --target_file="$settings"
|
||||
|
||||
|
@ -151,6 +153,8 @@ ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
|||
|
||||
touch "$final_path/local_settings.py"
|
||||
|
||||
cp "../conf/ynh_urls.py" "$final_path/ynh_urls.py"
|
||||
|
||||
#=================================================
|
||||
# MIGRATE / COLLECTSTATIC / CREATEADMIN
|
||||
#=================================================
|
||||
|
|
|
@ -132,6 +132,7 @@ ynh_replace_string --match_string="__ADMINMAIL__" --replace_string="$admin_mail"
|
|||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__FINAL_HOME_PATH__" --replace_string="$final_path" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__FINAL_WWW_PATH__" --replace_string="$public_path" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__LOG_FILE__" --replace_string="$log_file" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__REDIS_DB__" --replace_string="$redis_db" --target_file="$settings"
|
||||
|
||||
|
@ -140,6 +141,8 @@ ynh_store_file_checksum --file="$settings"
|
|||
|
||||
touch "$final_path/local_settings.py"
|
||||
|
||||
cp "../conf/ynh_urls.py" "$final_path/ynh_urls.py"
|
||||
|
||||
#=================================================
|
||||
# MIGRATE PYINVENTORY
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue