Apply manageprojects updates

This commit is contained in:
Jens Diemer 2023-11-26 13:06:24 +01:00
parent 38bedbe001
commit e3c844b4e4
9 changed files with 38 additions and 19 deletions

View file

@ -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__'

15
doc/ADMIN.md Normal file
View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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"

View file

@ -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]

View file

@ -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"

View file

@ -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',

View file

@ -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'