From e3c844b4e41c3066921f35c08f4d7240c1929a0f Mon Sep 17 00:00:00 2001 From: Jens Diemer Date: Sun, 26 Nov 2023 13:06:24 +0100 Subject: [PATCH] Apply manageprojects updates --- conf/settings.py | 2 +- doc/ADMIN.md | 15 +++++++++++++++ doc/DESCRIPTION.md | 13 +++++-------- for_runners_ynh/cli/dev.py | 7 ++++++- manifest.toml | 11 ++++++----- pyproject.toml | 3 ++- scripts/_common.sh | 2 +- tests/conftest.py | 2 +- tests/test_django_project.py | 2 +- 9 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 doc/ADMIN.md diff --git a/conf/settings.py b/conf/settings.py index f16f24b..1c38a43 100644 --- a/conf/settings.py +++ b/conf/settings.py @@ -40,7 +40,7 @@ YNH_CURRENT_HOST = '__YNH_CURRENT_HOST__' # YunoHost main domain from: /etc/yun # config_panel.toml settings: DEBUG_ENABLED = '__DEBUG_ENABLED__' -DEBUG = DEBUG_ENABLED == 'YES' +DEBUG = DEBUG_ENABLED == '1' LOG_LEVEL = '__LOG_LEVEL__' ADMIN_EMAIL = '__ADMIN_EMAIL__' diff --git a/doc/ADMIN.md b/doc/ADMIN.md new file mode 100644 index 0000000..a7363cc --- /dev/null +++ b/doc/ADMIN.md @@ -0,0 +1,15 @@ +## Settings and upgrades + +Almost everything related to django-for-runners's configuration is handled in a `"../conf/settings.py"` file. +You can edit the file `/home/yunohost.app/django_for_runners/local_settings.py` to enable or disable features. + +Test sending emails, e.g.: + +```bash +ssh admin@yourdomain.tld +root@yunohost:~# /home/yunohost.app/django_for_runners/manage.py sendtestemail --admins +``` + +How to debug a django YunoHost app, take a look into: + +* https://github.com/YunoHost-Apps/django_example_ynh#developer-info diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 3b199b2..814bac5 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,14 +1,11 @@ -![Logo](https://raw.githubusercontent.com/jedie/django-for-runners/main/for_runners/static/Django-ForRunners128.png) +[![tests](https://github.com/YunoHost-Apps/django-for-runners_ynh/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/YunoHost-Apps/django-for-runners_ynh/actions/workflows/tests.yml) +[![codecov](https://codecov.io/github/jedie/for_runners_ynh/branch/main/graph/badge.svg)](https://app.codecov.io/github/jedie/for_runners_ynh) +[![for_runners_ynh @ PyPi](https://img.shields.io/pypi/v/for_runners_ynh?label=for_runners_ynh%20%40%20PyPi)](https://pypi.org/project/for_runners_ynh/) +[![Python Versions](https://img.shields.io/pypi/pyversions/for_runners_ynh)](https://github.com/YunoHost-Apps/django-for-runners_ynh/blob/main/pyproject.toml) +[![License GPL-3.0-or-later](https://img.shields.io/pypi/l/for_runners_ynh)](https://github.com/YunoHost-Apps/django-for-runners_ynh/blob/main/LICENSE) [django-for-runners](https://github.com/jedie/django-for-runners) is a libre web-based management for your GPX tracks of your running (or other sports activity). Used [Python](https://www.python.org/)/[Django](https://www.djangoproject.com/). - -[![pytest](https://github.com/YunoHost-Apps/django-for-runners_ynh/actions/workflows/pytest.yml/badge.svg?branch=master)](https://github.com/YunoHost-Apps/django-for-runners_ynh/actions/workflows/pytest.yml) [![YunoHost apps package linter](https://github.com/YunoHost-Apps/django-for-runners_ynh/actions/workflows/package_linter.yml/badge.svg)](https://github.com/YunoHost-Apps/django-for-runners_ynh/actions/workflows/package_linter.yml) [![Coverage Status on codecov.io](https://codecov.io/gh/YunoHost-Apps/django-for-runners_ynh/branch/master/graph/badge.svg)](https://codecov.io/gh/YunoHost-Apps/django-for-runners_ynh) - -![django-for-runners @ PyPi](https://img.shields.io/pypi/v/django-for-runners?label=django-for-runners%20%40%20PyPi) -![Python Versions](https://img.shields.io/pypi/pyversions/django-for-runners) -![License GPL V3+](https://img.shields.io/pypi/l/django-for-runners) - Pull requests welcome ;) This package for YunoHost used [django-yunohost-integration](https://github.com/YunoHost-Apps/django_yunohost_integration) diff --git a/for_runners_ynh/cli/dev.py b/for_runners_ynh/cli/dev.py index 92d4495..fbf1d89 100644 --- a/for_runners_ynh/cli/dev.py +++ b/for_runners_ynh/cli/dev.py @@ -336,7 +336,12 @@ def diffsettings(): }, ) app_path = destination / 'opt_yunohost' - verbose_check_call(sys.executable, app_path / 'manage.py', 'diffsettings', cwd=app_path) + verbose_check_call( + sys.executable, + app_path / 'manage.py', + 'diffsettings', + cwd=app_path, + ) cli.add_command(diffsettings) diff --git a/manifest.toml b/manifest.toml index 9686e69..63ca302 100644 --- a/manifest.toml +++ b/manifest.toml @@ -13,12 +13,12 @@ maintainers = ["Jens Diemer"] [upstream] # https://yunohost.org/en/packaging_manifest#upstream-section license = "GPL-3.0-or-later" -website = "https://github.com/YunoHost-Apps/django-for-runners_ynh" admindoc = "https://github.com/YunoHost-Apps/django-for-runners_ynh" userdoc = "https://github.com/jedie/django-for-runners" code = "https://github.com/YunoHost-Apps/django-for-runners_ynh" + [integration] # https://yunohost.org/en/packaging_manifest#integration-section yunohost = ">=11" @@ -31,7 +31,10 @@ ram.build = "50M" # **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, .. ram.runtime = "50M" # **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + [install] +# https://yunohost.org/en/packaging_manifest#install-questions + [install.domain] # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" @@ -61,11 +64,9 @@ ram.runtime = "50M" # **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, type = "email" example = "admin@example.com" - [install.debug_enabled] # __DEBUG_ENABLED__ + [install.debug_enabled] # __DEBUG_ENABLED__ will be set to "0" or "1" string ask.en = "Should be never enabled in production!" - type = "select" - choices = ["YES", "NO"] - default = "NO" + type = "boolean" [install.log_level] # __LOG_LEVEL__ ask.en = "Logging level" diff --git a/pyproject.toml b/pyproject.toml index 4fb6ff9..2262df2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dependencies = [ [project.optional-dependencies] dev = [ "bx_django_utils", # https://github.com/boxine/bx_django_utils - "beautifulsoup4", + "beautifulsoup4", # https://pypi.org/project/beautifulsoup4/ # # TODO: Remove "pytest" and use normal unittests ;) "pytest", @@ -196,6 +196,7 @@ cookiecutter_directory = "yunohost_django_package" applied_migrations = [ "183124a", # 2023-04-04T12:26:15+02:00 "3383cb0", # 2023-11-09T20:14:05+01:00 + "4abd4c0", # 2023-11-25T15:59:31+01:00 ] [manageprojects.cookiecutter_context.cookiecutter] diff --git a/scripts/_common.sh b/scripts/_common.sh index f3536db..244e91a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -13,7 +13,7 @@ __YNH_CURRENT_HOST__=${ynh_current_host} #================================================= # 'debug_enabled' -> '__DEBUG_ENABLED__' -> settings.DEBUG -debug_enabled="NO" # "YES" or "NO" string +debug_enabled="0" # "1" or "0" string # 'log_level' -> '__LOG_LEVEL__' -> settings.LOG_LEVEL log_level="WARNING" diff --git a/tests/conftest.py b/tests/conftest.py index 8e36ec5..bb04271 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -26,7 +26,7 @@ def pytest_configure(): destination=BASE_PATH / 'local_test', runserver=False, extra_replacements={ - '__DEBUG_ENABLED__': 'NO', # "YES" or "NO" string + '__DEBUG_ENABLED__': '0', # "1" or "0" string '__LOG_LEVEL__': 'INFO', '__ADMIN_EMAIL__': 'foo-bar@test.tld', '__DEFAULT_FROM_EMAIL__': 'django_app@test.tld', diff --git a/tests/test_django_project.py b/tests/test_django_project.py index 074bf3c..1fcf08a 100644 --- a/tests/test_django_project.py +++ b/tests/test_django_project.py @@ -34,7 +34,7 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase): def test_config_panel_settings(self): # config_panel.toml settings, set via tests.conftest.pytest_configure(): - assert settings.DEBUG_ENABLED == 'NO' and settings.DEBUG is False + assert settings.DEBUG_ENABLED == '0' and settings.DEBUG is False assert settings.LOG_LEVEL == 'INFO' assert settings.ADMIN_EMAIL == 'foo-bar@test.tld' assert settings.DEFAULT_FROM_EMAIL == 'django_app@test.tld'