diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 4cfde62..fe66505 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -14,7 +14,7 @@ jobs: strategy: max-parallel: 2 matrix: - python-version: ["3.10", "3.9", "3.8", "3.7"] + python-version: ["3.10", "3.9"] steps: - uses: actions/checkout@v2 with: diff --git a/Makefile b/Makefile index ab87b30..18d735b 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ install: check-poetry ## install project via poetry update: check-poetry ## update the sources and installation and generate "conf/requirements.txt" poetry self update poetry update -v + poetry install poetry export -f requirements.txt --output conf/requirements.txt lint: ## Run code formatters and linter diff --git a/README.md b/README.md index 0e6e212..810c606 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Demo [YunoHost Application](https://install-app.yunohost.org/?app=django_example_ynh) to demonstrate the integration of a [Python](https://www.python.org/)/[Django](https://www.djangoproject.com/) project under YunoHost using [django_yunohost_integration](https://github.com/YunoHost-Apps/django_yunohost_integration). +To demonstrate the functionality the small [django-example](https://github.com/jedie/django-example) app will be installed. + [![Integration level](https://dash.yunohost.org/integration/django_example_ynh.svg)](https://dash.yunohost.org/appci/app/django_example_ynh) ![](https://ci-apps.yunohost.org/ci/badges/django_example_ynh.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/django_example_ynh.maintain.svg) [![Install django_example_ynh with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=django_example_ynh) @@ -26,8 +28,7 @@ Demo [YunoHost Application](https://install-app.yunohost.org/?app=django_example Pull requests welcome ;) -**Shipped version:** 0.4.1~ynh1 *(:warning: This is the `testing` branch. The [`master` branch](https://github.com/YunoHost-Apps/django_example_ynh_ynh/tree/master) used in the catalog is currently on version 0.4.0\~ynh1.)* - +**Shipped version:** 0.5.0rc1~ynh1 ## Disclaimers / important information ## local test diff --git a/README_fr.md b/README_fr.md index 57ab1d4..b901c4f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,6 +19,8 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Demo [YunoHost Application](https://install-app.yunohost.org/?app=django_example_ynh) to demonstrate the integration of a [Python](https://www.python.org/)/[Django](https://www.djangoproject.com/) project under YunoHost using [django_yunohost_integration](https://github.com/YunoHost-Apps/django_yunohost_integration). +To demonstrate the functionality the small [django-example](https://github.com/jedie/django-example) app will be installed. + [![Integration level](https://dash.yunohost.org/integration/django_example_ynh.svg)](https://dash.yunohost.org/appci/app/django_example_ynh) ![](https://ci-apps.yunohost.org/ci/badges/django_example_ynh.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/django_example_ynh.maintain.svg) [![Install django_example_ynh with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=django_example_ynh) @@ -26,8 +28,7 @@ Demo [YunoHost Application](https://install-app.yunohost.org/?app=django_example Pull requests welcome ;) -**Version incluse :** 0.4.1~ynh1 *(:warning: Il s'agit de la branche `testing`. La [branche `master`](https://github.com/YunoHost-Apps/django_example_ynh_ynh/tree/master) utilisée dans le catalogue est actuellement en 0.4.0\~ynh1.)* - +**Version incluse :** 0.5.0rc1~ynh1 ## Avertissements / informations importantes ## local test diff --git a/conf/requirements.txt b/conf/requirements.txt index 07a629f..20ebf4e 100644 --- a/conf/requirements.txt +++ b/conf/requirements.txt @@ -1,51 +1,60 @@ -asgiref==3.5.2 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +asgiref==3.5.2 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:1d2880b792ae8757289136f1db2b7b99100ce959b2aa57fd69dab783d05afac4 \ --hash=sha256:4a29362a6acebe09bf1d6640db38c1dc3d9217c68e6f9f6204d72667fc19a424 -async-timeout==4.0.2 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +async-timeout==4.0.2 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15 \ --hash=sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c -bleach==5.0.1 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +bleach==5.0.1 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:085f7f33c15bd408dd9b17a4ad77c577db66d76203e5984b1bd59baeee948b2a \ --hash=sha256:0d03255c47eb9bd2f26aa9bb7f2107732e7e8fe195ca2f64709fcf3b0a4a085c -bx-py-utils==69 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +bx-django-utils==36 ; python_version >= "3.9" and python_full_version < "4.0.0" \ + --hash=sha256:98f900da91e3cdb22d2f386863fe05e58cfc18ff2d7c0ee656e7d551a135f529 \ + --hash=sha256:badb8d7fb04ce449cac7896ee435e69d2786eebc3e8c756e99e9379be816cd5f +bx-py-utils==69 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:728fd575c4d5048e114b502a97d19679f9abcda90889a6896534c48348320460 \ --hash=sha256:b25419e020c9c5ea16938a45cf5120086a5ac29648be78a8eb98ae202515fee1 -deprecated==1.2.13 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +colorama==0.4.5 ; python_version >= "3.9" and python_full_version < "4.0.0" and sys_platform == "win32" \ + --hash=sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da \ + --hash=sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4 +colorlog==6.7.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \ + --hash=sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662 \ + --hash=sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5 +deprecated==1.2.13 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:43ac5335da90c31c24ba028af536a91d41d53f9e6901ddb021bcc572ce44e38d \ --hash=sha256:64756e3e14c8c5eea9795d93c524551432a0be75629f8f29e67ab8caf076c76d -django-axes==5.39.0 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +django-axes==5.39.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:8f039f8e98f050f13f654efca599d8a04d0b57d330c590cf89ec2bf731c9a7fb \ --hash=sha256:97702552f7939c81db5bba2ef855ae43f20df92fa261cb79fd4c8633ba3b3955 -django-ipware==4.0.2 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +django-example==0.1.0rc0 ; python_version >= "3.9" and python_full_version < "4.0.0" \ + --hash=sha256:9bf31725f539d6c3489fd29a743f496fce1080164f5a62b87a6af2be04ca81c0 \ + --hash=sha256:de4460c2175506dcb528ac4f98df8c436c2d102f8d08c77b766cf406038eef53 +django-ipware==4.0.2 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:602a58325a4808bd19197fef2676a0b2da2df40d0ecf21be414b2ff48c72ad05 \ --hash=sha256:878dbb06a87e25550798e9ef3204ed70a200dd8b15e47dcef848cf08244f04c9 -django-redis==5.2.0 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +django-redis==5.2.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:1d037dc02b11ad7aa11f655d26dac3fb1af32630f61ef4428860a2e29ff92026 \ --hash=sha256:8a99e5582c79f894168f5865c52bd921213253b7fd64d16733ae4591564465de -django-tools==0.54.0 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +django-tools==0.54.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:5040a91282be9d1c9d379b0c65da50bcb3691bff03cee54fd4123ace238c3a43 \ --hash=sha256:a7b7bfa5b9c5a81966454d17dffb2403cee25a806c858ee0486a08798227598f -django-yunohost-integration[ynh]==0.4.1 ; python_version >= "3.7" and python_full_version < "4.0.0" \ - --hash=sha256:3769859db283a6b4d17468aeb1decab2f79d4b3e128b341342948e7bb3121e8a \ - --hash=sha256:e097cd209f3e09cbe325eadea36e3eb64c051690297c38dd89a1cd64bc35d92e -django==3.2.15 ; python_version >= "3.7" and python_full_version < "4.0.0" \ - --hash=sha256:115baf5049d5cf4163e43492cdc7139c306ed6d451e7d3571fe9612903903713 \ - --hash=sha256:f71934b1a822f14a86c9ac9634053689279cd04ae69cb6ade4a59471b886582b -gunicorn==20.1.0 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +django-yunohost-integration[ynh]==0.5.0rc1 ; python_version >= "3.9" and python_full_version < "4.0.0" \ + --hash=sha256:0e6d8ec12d48d9897c9dc02fc60c35bb3c7cc5f9446961fc0be61bb6f5586197 \ + --hash=sha256:5d8823acb83a668a5126e1324d2c3c7b239595a77a03d8c9bdaa8446154c64e4 +django==4.1.2 ; python_version >= "3.9" and python_full_version < "4.0.0" \ + --hash=sha256:26dc24f99c8956374a054bcbf58aab8dc0cad2e6ac82b0fe036b752c00eee793 \ + --hash=sha256:b8d843714810ab88d59344507d4447be8b2cf12a49031363b6eed9f1b9b2280f +gunicorn==20.1.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e \ --hash=sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8 -icdiff==2.0.5 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +icdiff==2.0.5 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:35d24b728e48b7e0a12bdb69386d3bfc7eef4fe922d0ac1cd70d6e5c11630bae -importlib-metadata==4.2.0 ; python_version >= "3.7" and python_version < "3.8" \ - --hash=sha256:057e92c15bc8d9e8109738a48db0ccb31b4d9d5cfbee5a8670879a30be66304b \ - --hash=sha256:b7e52a1f8dec14a75ea73e0891f3060099ca1d8e6a462a4dff11c3e119ea1b31 -packaging==21.3 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +packaging==21.3 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 -pprintpp==0.4.0 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +pprintpp==0.4.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:b6b4dcdd0c0c0d75e4d7b2f21a9e933e5b2ce62b26e1a54537f9651ae5a5c01d \ --hash=sha256:ea826108e2c7f49dc6d66c752973c3fc9749142a798d6b254e1e301cfdbc6403 -psycopg2==2.9.3 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +psycopg2==2.9.3 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:06f32425949bd5fe8f625c49f17ebb9784e1e4fe928b7cce72edc36fb68e4c0c \ --hash=sha256:0762c27d018edbcb2d34d51596e4346c983bd27c330218c56c4dc25ef7e819bf \ --hash=sha256:083707a696e5e1c330af2508d8fab36f9700b26621ccbcb538abe22e15485362 \ @@ -57,31 +66,31 @@ psycopg2==2.9.3 ; python_version >= "3.7" and python_full_version < "4.0.0" \ --hash=sha256:a81e3866f99382dfe8c15a151f1ca5fde5815fde879348fe5a9884a7c092a305 \ --hash=sha256:cb10d44e6694d763fa1078a26f7f6137d69f555a78ec85dc2ef716c37447e4b2 \ --hash=sha256:d3ca6421b942f60c008f81a3541e8faf6865a28d5a9b48544b0ee4f40cac7fca -pyparsing==3.0.9 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +pyparsing==3.0.9 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc -pytz==2022.4 ; python_version >= "3.7" and python_full_version < "4.0.0" \ - --hash=sha256:2c0784747071402c6e99f0bafdb7da0fa22645f06554c7ae06bf6358897e9c91 \ - --hash=sha256:48ce799d83b6f8aab2020e369b627446696619e79645419610b9facd909b3174 -redis==4.3.4 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +python-stdnum==1.17 ; python_version >= "3.9" and python_full_version < "4.0.0" \ + --hash=sha256:374e2b5e13912ccdbf50b0b23fca2c3e0531174805c32d74e145f37756328340 \ + --hash=sha256:a46e6cf9652807314d369b654b255c86a59f93d18be2834f3d567ed1a346c547 +redis==4.3.4 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:a52d5694c9eb4292770084fa8c863f79367ca19884b329ab574d5cb2036b3e54 \ --hash=sha256:ddf27071df4adf3821c4f2ca59d67525c3a82e5f268bed97b813cb4fabf87880 -setuptools==65.4.1 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +setuptools==65.4.1 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:1b6bdc6161661409c5f21508763dc63ab20a9ac2f8ba20029aaaa7fdb9118012 \ --hash=sha256:3050e338e5871e70c72983072fe34f6032ae1cdeeeb67338199c2f74e083a80e -six==1.16.0 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +six==1.16.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 -sqlparse==0.4.3 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +sqlparse==0.4.3 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:0323c0ec29cd52bceabc1b4d9d579e311f3e4961b98d174201d5622a23b85e34 \ --hash=sha256:69ca804846bb114d2ec380e4360a8a340db83f0ccf3afceeb1404df028f57268 -typing-extensions==4.3.0 ; python_version >= "3.7" and python_version < "3.8" \ - --hash=sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02 \ - --hash=sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6 -webencodings==0.5.1 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +tzdata==2022.4 ; python_version >= "3.9" and python_full_version < "4.0.0" and sys_platform == "win32" \ + --hash=sha256:74da81ecf2b3887c94e53fc1d466d4362aaf8b26fc87cda18f22004544694583 \ + --hash=sha256:ada9133fbd561e6ec3d1674d3fba50251636e918aa97bd59d63735bef5a513bb +webencodings==0.5.1 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \ --hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923 -wrapt==1.14.1 ; python_version >= "3.7" and python_full_version < "4.0.0" \ +wrapt==1.14.1 ; python_version >= "3.9" and python_full_version < "4.0.0" \ --hash=sha256:00b6d4ea20a906c0ca56d84f93065b398ab74b927a7a3dbd470f6fc503f95dc3 \ --hash=sha256:01c205616a89d09827986bc4e859bcabd64f5a0662a7fe95e0d359424e0e071b \ --hash=sha256:02b41b633c6261feff8ddd8d11c711df6842aba629fdd3da10249a53211a72c4 \ @@ -146,6 +155,3 @@ wrapt==1.14.1 ; python_version >= "3.7" and python_full_version < "4.0.0" \ --hash=sha256:ee2b1b1769f6707a8a445162ea16dddf74285c3964f605877a20e38545c3c462 \ --hash=sha256:ee6acae74a2b91865910eef5e7de37dc6895ad96fa23603d1d27ea69df545015 \ --hash=sha256:ef3f72c9666bba2bab70d2a8b79f2c6d2c1a42a7f7e2b0ec83bb2f9e383950af -zipp==3.8.1 ; python_version >= "3.7" and python_version < "3.8" \ - --hash=sha256:05b45f1ee8f807d0cc928485ca40a07cb491cf092ff587c0df9cb1fd154848d2 \ - --hash=sha256:47c40d7fe183a6f21403a199b3e4192cca5774656965b0a4988ad2f8feb5f009 diff --git a/conf/settings.py b/conf/settings.py index f6f69bb..b7506b6 100644 --- a/conf/settings.py +++ b/conf/settings.py @@ -15,6 +15,13 @@ from django_yunohost_integration.base_settings import * # noqa:F401,F403 from django_yunohost_integration.secret_key import get_or_create_secret as __get_or_create_secret +# https://github.com/jedie/django-example/ +from django_example.settings.prod import * # noqa:F401,F403 isort:skip + + +from django_yunohost_integration.base_settings import LOGGING # noqa:F401 isort:skip + + FINALPATH = __Path('__FINALPATH__') # /opt/yunohost/$app assert FINALPATH.is_dir(), f'Directory not exists: {FINALPATH}' @@ -27,6 +34,8 @@ assert LOG_FILE.is_file(), f'File not exists: {LOG_FILE}' PATH_URL = '__PATH_URL__' # $YNH_APP_ARG_PATH PATH_URL = PATH_URL.strip('/') +YNH_CURRENT_HOST = '__YNH_CURRENT_HOST__' # YunoHost main domain from: /etc/yunohost/current_host + # ----------------------------------------------------------------------------- # config_panel.toml settings: @@ -45,13 +54,18 @@ YNH_SETUP_USER = 'setup_user.setup_project_user' SECRET_KEY = __get_or_create_secret(FINALPATH / 'secret.txt') # /opt/yunohost/$app/secret.txt -# INSTALLED_APPS.append('') +INSTALLED_APPS += [ + 'axes', # https://github.com/jazzband/django-axes + 'django_yunohost_integration.apps.YunohostIntegrationConfig', +] MIDDLEWARE.insert( MIDDLEWARE.index('django.contrib.auth.middleware.AuthenticationMiddleware') + 1, # login a user via HTTP_REMOTE_USER header from SSOwat: 'django_yunohost_integration.sso_auth.auth_middleware.SSOwatRemoteUserMiddleware', ) +# AxesMiddleware should be the last middleware: +MIDDLEWARE.append('axes.middleware.AxesMiddleware') # Keep ModelBackend around for per-user permissions and superuser AUTHENTICATION_BACKENDS = ( @@ -146,7 +160,7 @@ MEDIA_ROOT = str(PUBLIC_PATH / 'media') LOGGING['handlers']['log_file']['filename'] = str(LOG_FILE) # Example how to add logging to own app: -LOGGING['loggers']['django_example_ynh'] = { +LOGGING['loggers']['django_example'] = { 'handlers': ['syslog', 'log_file', 'mail_admins'], 'level': 'INFO', 'propagate': False, diff --git a/conf/urls.py b/conf/urls.py index 9fc213c..5927078 100644 --- a/conf/urls.py +++ b/conf/urls.py @@ -2,9 +2,6 @@ urls.py ~~~~~~~ - Note: This is not a good example how your urls.py can look like. - Because this setup is just an example without a real Python application. - Look at real examples, here: * https://github.com/YunoHost-Apps/django-fritzconnection_ynh/blob/master/conf/urls.py @@ -15,22 +12,18 @@ from django.conf import settings -from django.contrib import admin -from django.urls import path - -from django_yunohost_integration.views import request_media_debug_view +from django.urls import include, path +from django.views.generic import RedirectView if settings.PATH_URL: # settings.PATH_URL is the $YNH_APP_ARG_PATH # Prefix all urls with "PATH_URL": urlpatterns = [ - path(f'{settings.PATH_URL}/debug/', request_media_debug_view), - path(f'{settings.PATH_URL}/', admin.site.urls), + path('', RedirectView.as_view(url=f'{settings.PATH_URL}/')), + path(f'{settings.PATH_URL}/', include('django_example.urls')), ] else: # Installed to domain root, without a path prefix - urlpatterns = [ - path('debug/', request_media_debug_view), - path('', admin.site.urls), - ] + # Just use the default project urls.py + from django_example.urls import urlpatterns # noqa diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index d331dd7..9f5957d 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -2,6 +2,8 @@ Demo [YunoHost Application](https://install-app.yunohost.org/?app=django_example_ynh) to demonstrate the integration of a [Python](https://www.python.org/)/[Django](https://www.djangoproject.com/) project under YunoHost using [django_yunohost_integration](https://github.com/YunoHost-Apps/django_yunohost_integration). +To demonstrate the functionality the small [django-example](https://github.com/jedie/django-example) app will be installed. + [![Integration level](https://dash.yunohost.org/integration/django_example_ynh.svg)](https://dash.yunohost.org/appci/app/django_example_ynh) ![](https://ci-apps.yunohost.org/ci/badges/django_example_ynh.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/django_example_ynh.maintain.svg) [![Install django_example_ynh with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=django_example_ynh) diff --git a/manifest.json b/manifest.json index 97bf716..4790b31 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": "App to demonstrate the integration of a Django project under YunoHost via https://github.com/YunoHost-Apps/django_yunohost_integration" }, - "version": "0.4.1~ynh1", + "version": "0.5.0rc1~ynh1", "url": "https://github.com/YunoHost-Apps/django_example_ynh", "upstream": { "license": "GPL-3.0", @@ -21,7 +21,7 @@ }, "previous_maintainers": [], "requirements": { - "yunohost": ">= 4.4" + "yunohost": ">=11" }, "multi_instance": true, "services": [ diff --git a/poetry.lock b/poetry.lock index 36199c4..67f4139 100644 --- a/poetry.lock +++ b/poetry.lock @@ -6,9 +6,6 @@ category = "main" optional = false python-versions = ">=3.7" -[package.dependencies] -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} - [package.extras] tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"] @@ -20,9 +17,6 @@ category = "main" optional = false python-versions = ">=3.6" -[package.dependencies] -typing-extensions = {version = ">=3.6.5", markers = "python_version < \"3.8\""} - [[package]] name = "attrs" version = "22.1.0" @@ -37,6 +31,21 @@ docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"] tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "zope.interface"] tests_no_zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] +[[package]] +name = "beautifulsoup4" +version = "4.11.1" +description = "Screen-scraping library" +category = "dev" +optional = false +python-versions = ">=3.6.0" + +[package.dependencies] +soupsieve = ">1.2" + +[package.extras] +html5lib = ["html5lib"] +lxml = ["lxml"] + [[package]] name = "black" version = "22.8.0" @@ -51,7 +60,6 @@ mypy-extensions = ">=0.4.3" pathspec = ">=0.9.0" platformdirs = ">=2" tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} -typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\" and implementation_name == \"cpython\""} typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} [package.extras] @@ -78,9 +86,9 @@ dev = ["Sphinx (==4.3.2)", "black (==22.3.0)", "build (==0.8.0)", "flake8 (==4.0 [[package]] name = "bx-django-utils" -version = "35" +version = "36" description = "Various Django utility functions" -category = "dev" +category = "main" optional = false python-versions = ">=3.7,<4.0.0" @@ -126,16 +134,29 @@ python-versions = ">=3.7" [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [[package]] name = "colorama" version = "0.4.5" description = "Cross-platform colored terminal text." -category = "dev" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +[[package]] +name = "colorlog" +version = "6.7.0" +description = "Add colours to the output of Python's logging module." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} + +[package.extras] +development = ["black", "flake8", "mypy", "pytest", "types-colorama"] + [[package]] name = "coverage" version = "6.5.0" @@ -177,7 +198,6 @@ python-versions = ">=3.7" [package.dependencies] black = ">=21.5b1" toml = ">=0.10.0" -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} [package.extras] color = ["Pygments (>=2.4.0)"] @@ -209,16 +229,16 @@ python-versions = "*" [[package]] name = "Django" -version = "3.2.15" -description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." +version = "4.1.2" +description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." category = "main" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" [package.dependencies] -asgiref = ">=3.3.2,<4" -pytz = "*" +asgiref = ">=3.5.2,<4" sqlparse = ">=0.2.2" +tzdata = {version = "*", markers = "sys_platform == \"win32\""} [package.extras] argon2 = ["argon2-cffi (>=19.1.0)"] @@ -237,6 +257,17 @@ django = ">=3.2" django-ipware = ">=3" setuptools = "*" +[[package]] +name = "django-example" +version = "0.1.0rc0" +description = "Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost." +category = "main" +optional = false +python-versions = ">=3.9,<4.0.0" + +[package.dependencies] +bx_django_utils = "*" + [[package]] name = "django-ipware" version = "4.0.2" @@ -277,17 +308,18 @@ pprintpp = "*" [[package]] name = "django-yunohost-integration" -version = "0.4.1" +version = "0.5.0rc1" description = "Glue code to package django projects as yunohost apps." category = "main" optional = false -python-versions = ">=3.7,<4.0.0" +python-versions = ">=3.9,<4.0.0" [package.dependencies] +colorlog = "*" django = "*" django-axes = {version = "*", optional = true, markers = "extra == \"ynh\""} django-redis = {version = "*", optional = true, markers = "extra == \"ynh\""} -django-tools = ">=0.54.0" +django-tools = "*" gunicorn = {version = "*", optional = true, markers = "extra == \"ynh\""} psycopg2 = {version = "*", optional = true, markers = "extra == \"ynh\""} @@ -347,7 +379,6 @@ optional = false python-versions = ">=3.6.1" [package.dependencies] -importlib-metadata = {version = ">=1.1.0,<4.3", markers = "python_version < \"3.8\""} mccabe = ">=0.7.0,<0.8.0" pycodestyle = ">=2.9.0,<2.10.0" pyflakes = ">=2.5.0,<2.6.0" @@ -385,22 +416,6 @@ category = "dev" optional = false python-versions = ">=3.5" -[[package]] -name = "importlib-metadata" -version = "4.2.0" -description = "Read metadata from Python packages" -category = "main" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} -zipp = ">=0.5" - -[package.extras] -docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"] -testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pep517", "pyfakefs", "pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy"] - [[package]] name = "iniconfig" version = "1.1.1" @@ -478,9 +493,6 @@ category = "dev" optional = false python-versions = ">=3.6" -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] @@ -547,7 +559,6 @@ python-versions = ">=3.7" [package.dependencies] attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" @@ -582,7 +593,6 @@ python-versions = ">=3.6" [package.dependencies] darker = ">=1.1.0" -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} [package.extras] test = ["mypy (>=0.782)", "pytest (>=6.0.1)", "pytest-black", "pytest-isort (>=1.1.0)", "pytest-mypy"] @@ -606,7 +616,7 @@ testing = ["Django", "django-configurations (>=2.0)"] name = "python-stdnum" version = "1.17" description = "Python module to handle standardized numbers and codes" -category = "dev" +category = "main" optional = false python-versions = "*" @@ -615,14 +625,6 @@ soap = ["zeep"] soap-alt = ["suds"] soap-fallback = ["PySimpleSOAP"] -[[package]] -name = "pytz" -version = "2022.4" -description = "World timezone definitions, modern and historical" -category = "main" -optional = false -python-versions = "*" - [[package]] name = "redis" version = "4.3.4" @@ -634,9 +636,7 @@ python-versions = ">=3.6" [package.dependencies] async-timeout = ">=4.0.2" deprecated = ">=1.2.3" -importlib-metadata = {version = ">=1.0", markers = "python_version < \"3.8\""} packaging = ">=20.4" -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} [package.extras] hiredis = ["hiredis (>=1.0.0)"] @@ -685,7 +685,7 @@ python-versions = ">=3.5" [[package]] name = "safety" -version = "2.2.0" +version = "2.3.1" description = "Checks installed dependencies for known vulnerabilities and licenses." category = "dev" optional = false @@ -699,6 +699,10 @@ requests = "*" "ruamel.yaml" = ">=0.17.21" setuptools = ">=19.3" +[package.extras] +github = ["jinja2 (>=3.1.0)", "pygithub (>=1.43.3)"] +gitlab = ["python-gitlab (>=1.3.0)"] + [[package]] name = "setuptools" version = "65.4.1" @@ -720,6 +724,14 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +[[package]] +name = "soupsieve" +version = "2.3.2.post1" +description = "A modern CSS selector implementation for Beautiful Soup." +category = "dev" +optional = false +python-versions = ">=3.6" + [[package]] name = "sqlparse" version = "0.4.3" @@ -755,7 +767,6 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [package.dependencies] colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""} filelock = ">=3.0.0" -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} packaging = ">=14" pluggy = ">=0.12.0" py = ">=1.4.17" @@ -767,22 +778,22 @@ virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2, docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"] testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "pathlib2 (>=2.3.3)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)"] -[[package]] -name = "typed-ast" -version = "1.5.4" -description = "a fork of Python 2 and 3 ast modules with type comment support" -category = "dev" -optional = false -python-versions = ">=3.6" - [[package]] name = "typing-extensions" version = "4.3.0" description = "Backported and Experimental Type Hints for Python 3.7+" -category = "main" +category = "dev" optional = false python-versions = ">=3.7" +[[package]] +name = "tzdata" +version = "2022.4" +description = "Provider of IANA time zone data" +category = "main" +optional = false +python-versions = ">=2" + [[package]] name = "urllib3" version = "1.26.12" @@ -798,21 +809,20 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [[package]] name = "virtualenv" -version = "20.16.2" +version = "20.16.5" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = ">=3.6" [package.dependencies] -distlib = ">=0.3.1,<1" -filelock = ">=3.2,<4" -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} -platformdirs = ">=2,<3" +distlib = ">=0.3.5,<1" +filelock = ">=3.4.1,<4" +platformdirs = ">=2.4,<3" [package.extras] -docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=21.3)"] -testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "packaging (>=20.0)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)"] +docs = ["proselint (>=0.13)", "sphinx (>=5.1.1)", "sphinx-argparse (>=0.3.1)", "sphinx-rtd-theme (>=1)", "towncrier (>=21.9)"] +testing = ["coverage (>=6.2)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=21.3)", "pytest (>=7.0.1)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.6.1)", "pytest-randomly (>=3.10.3)", "pytest-timeout (>=2.1)"] [[package]] name = "webencodings" @@ -830,22 +840,10 @@ category = "main" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" -[[package]] -name = "zipp" -version = "3.8.1" -description = "Backport of pathlib-compatible object wrapper for zip files" -category = "main" -optional = false -python-versions = ">=3.7" - -[package.extras] -docs = ["jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx"] -testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] - [metadata] lock-version = "1.1" -python-versions = ">=3.7,<4.0.0" # TODO: Update to >=3.8 after YunoHost updates to Bullseye -content-hash = "e6ef70b3065c3d060fc1c21df04efe09085c45e8176bc737ab6791f1f03425fb" +python-versions = ">=3.9,<4.0.0" # Stay with 3.9 until YunoHost used >=Debian 11 (Bullseye) +content-hash = "781bb51fa747ad3d2dad740bd4050528e838abdb8262ae7be545c12845145469" [metadata.files] asgiref = [ @@ -860,6 +858,10 @@ attrs = [ {file = "attrs-22.1.0-py2.py3-none-any.whl", hash = "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"}, {file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"}, ] +beautifulsoup4 = [ + {file = "beautifulsoup4-4.11.1-py3-none-any.whl", hash = "sha256:58d5c3d29f5a36ffeb94f02f0d786cd53014cf9b3b3951d42e0080d8a9498d30"}, + {file = "beautifulsoup4-4.11.1.tar.gz", hash = "sha256:ad9aa55b65ef2808eb405f46cf74df7fcb7044d5cbc26487f96eb2ef2e436693"}, +] black = [ {file = "black-22.8.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ce957f1d6b78a8a231b18e0dd2d94a33d2ba738cd88a7fe64f53f659eea49fdd"}, {file = "black-22.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5107ea36b2b61917956d018bd25129baf9ad1125e39324a9b18248d362156a27"}, @@ -890,8 +892,8 @@ bleach = [ {file = "bleach-5.0.1.tar.gz", hash = "sha256:0d03255c47eb9bd2f26aa9bb7f2107732e7e8fe195ca2f64709fcf3b0a4a085c"}, ] bx-django-utils = [ - {file = "bx_django_utils-35-py3-none-any.whl", hash = "sha256:341b27ad0b72a903acf2f28def0fe371def811c1b2305da9806124869a698fc8"}, - {file = "bx_django_utils-35.tar.gz", hash = "sha256:5151806d349a9dafc8dba9636239422022bab211b5b02afa52fce1f58ec2e6ab"}, + {file = "bx_django_utils-36-py3-none-any.whl", hash = "sha256:98f900da91e3cdb22d2f386863fe05e58cfc18ff2d7c0ee656e7d551a135f529"}, + {file = "bx_django_utils-36.tar.gz", hash = "sha256:badb8d7fb04ce449cac7896ee435e69d2786eebc3e8c756e99e9379be816cd5f"}, ] bx-py-utils = [ {file = "bx_py_utils-69-py3-none-any.whl", hash = "sha256:b25419e020c9c5ea16938a45cf5120086a5ac29648be78a8eb98ae202515fee1"}, @@ -913,6 +915,10 @@ colorama = [ {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"}, {file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"}, ] +colorlog = [ + {file = "colorlog-6.7.0-py2.py3-none-any.whl", hash = "sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662"}, + {file = "colorlog-6.7.0.tar.gz", hash = "sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5"}, +] coverage = [ {file = "coverage-6.5.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ef8674b0ee8cc11e2d574e3e2998aea5df5ab242e012286824ea3c6970580e53"}, {file = "coverage-6.5.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:784f53ebc9f3fd0e2a3f6a78b2be1bd1f5575d7863e10c6e12504f240fd06660"}, @@ -982,13 +988,17 @@ distlib = [ {file = "distlib-0.3.6.tar.gz", hash = "sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46"}, ] Django = [ - {file = "Django-3.2.15-py3-none-any.whl", hash = "sha256:115baf5049d5cf4163e43492cdc7139c306ed6d451e7d3571fe9612903903713"}, - {file = "Django-3.2.15.tar.gz", hash = "sha256:f71934b1a822f14a86c9ac9634053689279cd04ae69cb6ade4a59471b886582b"}, + {file = "Django-4.1.2-py3-none-any.whl", hash = "sha256:26dc24f99c8956374a054bcbf58aab8dc0cad2e6ac82b0fe036b752c00eee793"}, + {file = "Django-4.1.2.tar.gz", hash = "sha256:b8d843714810ab88d59344507d4447be8b2cf12a49031363b6eed9f1b9b2280f"}, ] django-axes = [ {file = "django-axes-5.39.0.tar.gz", hash = "sha256:97702552f7939c81db5bba2ef855ae43f20df92fa261cb79fd4c8633ba3b3955"}, {file = "django_axes-5.39.0-py3-none-any.whl", hash = "sha256:8f039f8e98f050f13f654efca599d8a04d0b57d330c590cf89ec2bf731c9a7fb"}, ] +django-example = [ + {file = "django-example-0.1.0rc0.tar.gz", hash = "sha256:de4460c2175506dcb528ac4f98df8c436c2d102f8d08c77b766cf406038eef53"}, + {file = "django_example-0.1.0rc0-py3-none-any.whl", hash = "sha256:9bf31725f539d6c3489fd29a743f496fce1080164f5a62b87a6af2be04ca81c0"}, +] django-ipware = [ {file = "django-ipware-4.0.2.tar.gz", hash = "sha256:602a58325a4808bd19197fef2676a0b2da2df40d0ecf21be414b2ff48c72ad05"}, {file = "django_ipware-4.0.2-py2.py3-none-any.whl", hash = "sha256:878dbb06a87e25550798e9ef3204ed70a200dd8b15e47dcef848cf08244f04c9"}, @@ -1002,8 +1012,8 @@ django-tools = [ {file = "django_tools-0.54.0-py3-none-any.whl", hash = "sha256:a7b7bfa5b9c5a81966454d17dffb2403cee25a806c858ee0486a08798227598f"}, ] django-yunohost-integration = [ - {file = "django_yunohost_integration-0.4.1-py3-none-any.whl", hash = "sha256:e097cd209f3e09cbe325eadea36e3eb64c051690297c38dd89a1cd64bc35d92e"}, - {file = "django_yunohost_integration-0.4.1.tar.gz", hash = "sha256:3769859db283a6b4d17468aeb1decab2f79d4b3e128b341342948e7bb3121e8a"}, + {file = "django_yunohost_integration-0.5.0rc1-py3-none-any.whl", hash = "sha256:0e6d8ec12d48d9897c9dc02fc60c35bb3c7cc5f9446961fc0be61bb6f5586197"}, + {file = "django_yunohost_integration-0.5.0rc1.tar.gz", hash = "sha256:5d8823acb83a668a5126e1324d2c3c7b239595a77a03d8c9bdaa8446154c64e4"}, ] docopt = [ {file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"}, @@ -1035,10 +1045,6 @@ idna = [ {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, ] -importlib-metadata = [ - {file = "importlib_metadata-4.2.0-py3-none-any.whl", hash = "sha256:057e92c15bc8d9e8109738a48db0ccb31b4d9d5cfbee5a8670879a30be66304b"}, - {file = "importlib_metadata-4.2.0.tar.gz", hash = "sha256:b7e52a1f8dec14a75ea73e0891f3060099ca1d8e6a462a4dff11c3e119ea1b31"}, -] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, @@ -1124,10 +1130,6 @@ python-stdnum = [ {file = "python-stdnum-1.17.tar.gz", hash = "sha256:374e2b5e13912ccdbf50b0b23fca2c3e0531174805c32d74e145f37756328340"}, {file = "python_stdnum-1.17-py2.py3-none-any.whl", hash = "sha256:a46e6cf9652807314d369b654b255c86a59f93d18be2834f3d567ed1a346c547"}, ] -pytz = [ - {file = "pytz-2022.4-py2.py3-none-any.whl", hash = "sha256:2c0784747071402c6e99f0bafdb7da0fa22645f06554c7ae06bf6358897e9c91"}, - {file = "pytz-2022.4.tar.gz", hash = "sha256:48ce799d83b6f8aab2020e369b627446696619e79645419610b9facd909b3174"}, -] redis = [ {file = "redis-4.3.4-py3-none-any.whl", hash = "sha256:a52d5694c9eb4292770084fa8c863f79367ca19884b329ab574d5cb2036b3e54"}, {file = "redis-4.3.4.tar.gz", hash = "sha256:ddf27071df4adf3821c4f2ca59d67525c3a82e5f268bed97b813cb4fabf87880"}, @@ -1173,8 +1175,8 @@ requests = [ {file = "ruamel.yaml.clib-0.2.6.tar.gz", hash = "sha256:4ff604ce439abb20794f05613c374759ce10e3595d1867764dd1ae675b85acbd"}, ] safety = [ - {file = "safety-2.2.0-py3-none-any.whl", hash = "sha256:b1a0f4c34fb41c502a7a5c54774c18376da382bc9d866ee26b39b2c747c0de40"}, - {file = "safety-2.2.0.tar.gz", hash = "sha256:6745de12acbd60a58001fe66cb540355187d7b991b30104d9ef14ff4e4826073"}, + {file = "safety-2.3.1-py3-none-any.whl", hash = "sha256:8f098d12b607db2756886280e85c28ece8db1bba4f45fc5f981f4663217bd619"}, + {file = "safety-2.3.1.tar.gz", hash = "sha256:6e6fcb7d4e8321098cf289f59b65051cafd3467f089c6e57c9f894ae32c23b71"}, ] setuptools = [ {file = "setuptools-65.4.1-py3-none-any.whl", hash = "sha256:1b6bdc6161661409c5f21508763dc63ab20a9ac2f8ba20029aaaa7fdb9118012"}, @@ -1184,6 +1186,10 @@ six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] +soupsieve = [ + {file = "soupsieve-2.3.2.post1-py3-none-any.whl", hash = "sha256:3b2503d3c7084a42b1ebd08116e5f81aadfaea95863628c80a3b774a11b7c759"}, + {file = "soupsieve-2.3.2.post1.tar.gz", hash = "sha256:fc53893b3da2c33de295667a0e19f078c14bf86544af307354de5fcf12a3f30d"}, +] sqlparse = [ {file = "sqlparse-0.4.3-py3-none-any.whl", hash = "sha256:0323c0ec29cd52bceabc1b4d9d579e311f3e4961b98d174201d5622a23b85e34"}, {file = "sqlparse-0.4.3.tar.gz", hash = "sha256:69ca804846bb114d2ec380e4360a8a340db83f0ccf3afceeb1404df028f57268"}, @@ -1200,43 +1206,21 @@ tox = [ {file = "tox-3.26.0-py2.py3-none-any.whl", hash = "sha256:bf037662d7c740d15c9924ba23bb3e587df20598697bb985ac2b49bdc2d847f6"}, {file = "tox-3.26.0.tar.gz", hash = "sha256:44f3c347c68c2c68799d7d44f1808f9d396fc8a1a500cbc624253375c7ae107e"}, ] -typed-ast = [ - {file = "typed_ast-1.5.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:669dd0c4167f6f2cd9f57041e03c3c2ebf9063d0757dc89f79ba1daa2bfca9d4"}, - {file = "typed_ast-1.5.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:211260621ab1cd7324e0798d6be953d00b74e0428382991adfddb352252f1d62"}, - {file = "typed_ast-1.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:267e3f78697a6c00c689c03db4876dd1efdfea2f251a5ad6555e82a26847b4ac"}, - {file = "typed_ast-1.5.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c542eeda69212fa10a7ada75e668876fdec5f856cd3d06829e6aa64ad17c8dfe"}, - {file = "typed_ast-1.5.4-cp310-cp310-win_amd64.whl", hash = "sha256:a9916d2bb8865f973824fb47436fa45e1ebf2efd920f2b9f99342cb7fab93f72"}, - {file = "typed_ast-1.5.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:79b1e0869db7c830ba6a981d58711c88b6677506e648496b1f64ac7d15633aec"}, - {file = "typed_ast-1.5.4-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a94d55d142c9265f4ea46fab70977a1944ecae359ae867397757d836ea5a3f47"}, - {file = "typed_ast-1.5.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:183afdf0ec5b1b211724dfef3d2cad2d767cbefac291f24d69b00546c1837fb6"}, - {file = "typed_ast-1.5.4-cp36-cp36m-win_amd64.whl", hash = "sha256:639c5f0b21776605dd6c9dbe592d5228f021404dafd377e2b7ac046b0349b1a1"}, - {file = "typed_ast-1.5.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cf4afcfac006ece570e32d6fa90ab74a17245b83dfd6655a6f68568098345ff6"}, - {file = "typed_ast-1.5.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ed855bbe3eb3715fca349c80174cfcfd699c2f9de574d40527b8429acae23a66"}, - {file = "typed_ast-1.5.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:6778e1b2f81dfc7bc58e4b259363b83d2e509a65198e85d5700dfae4c6c8ff1c"}, - {file = "typed_ast-1.5.4-cp37-cp37m-win_amd64.whl", hash = "sha256:0261195c2062caf107831e92a76764c81227dae162c4f75192c0d489faf751a2"}, - {file = "typed_ast-1.5.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2efae9db7a8c05ad5547d522e7dbe62c83d838d3906a3716d1478b6c1d61388d"}, - {file = "typed_ast-1.5.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7d5d014b7daa8b0bf2eaef684295acae12b036d79f54178b92a2b6a56f92278f"}, - {file = "typed_ast-1.5.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:370788a63915e82fd6f212865a596a0fefcbb7d408bbbb13dea723d971ed8bdc"}, - {file = "typed_ast-1.5.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:4e964b4ff86550a7a7d56345c7864b18f403f5bd7380edf44a3c1fb4ee7ac6c6"}, - {file = "typed_ast-1.5.4-cp38-cp38-win_amd64.whl", hash = "sha256:683407d92dc953c8a7347119596f0b0e6c55eb98ebebd9b23437501b28dcbb8e"}, - {file = "typed_ast-1.5.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4879da6c9b73443f97e731b617184a596ac1235fe91f98d279a7af36c796da35"}, - {file = "typed_ast-1.5.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3e123d878ba170397916557d31c8f589951e353cc95fb7f24f6bb69adc1a8a97"}, - {file = "typed_ast-1.5.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ebd9d7f80ccf7a82ac5f88c521115cc55d84e35bf8b446fcd7836eb6b98929a3"}, - {file = "typed_ast-1.5.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98f80dee3c03455e92796b58b98ff6ca0b2a6f652120c263efdba4d6c5e58f72"}, - {file = "typed_ast-1.5.4-cp39-cp39-win_amd64.whl", hash = "sha256:0fdbcf2fef0ca421a3f5912555804296f0b0960f0418c440f5d6d3abb549f3e1"}, - {file = "typed_ast-1.5.4.tar.gz", hash = "sha256:39e21ceb7388e4bb37f4c679d72707ed46c2fbf2a5609b8b8ebc4b067d977df2"}, -] typing-extensions = [ {file = "typing_extensions-4.3.0-py3-none-any.whl", hash = "sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02"}, {file = "typing_extensions-4.3.0.tar.gz", hash = "sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"}, ] +tzdata = [ + {file = "tzdata-2022.4-py2.py3-none-any.whl", hash = "sha256:74da81ecf2b3887c94e53fc1d466d4362aaf8b26fc87cda18f22004544694583"}, + {file = "tzdata-2022.4.tar.gz", hash = "sha256:ada9133fbd561e6ec3d1674d3fba50251636e918aa97bd59d63735bef5a513bb"}, +] urllib3 = [ {file = "urllib3-1.26.12-py2.py3-none-any.whl", hash = "sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"}, {file = "urllib3-1.26.12.tar.gz", hash = "sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e"}, ] virtualenv = [ - {file = "virtualenv-20.16.2-py2.py3-none-any.whl", hash = "sha256:635b272a8e2f77cb051946f46c60a54ace3cb5e25568228bd6b57fc70eca9ff3"}, - {file = "virtualenv-20.16.2.tar.gz", hash = "sha256:0ef5be6d07181946891f5abc8047fda8bc2f0b4b9bf222c64e6e8963baee76db"}, + {file = "virtualenv-20.16.5-py3-none-any.whl", hash = "sha256:d07dfc5df5e4e0dbc92862350ad87a36ed505b978f6c39609dc489eadd5b0d27"}, + {file = "virtualenv-20.16.5.tar.gz", hash = "sha256:227ea1b9994fdc5ea31977ba3383ef296d7472ea85be9d6732e42a91c04e80da"}, ] webencodings = [ {file = "webencodings-0.5.1-py2.py3-none-any.whl", hash = "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78"}, @@ -1308,7 +1292,3 @@ wrapt = [ {file = "wrapt-1.14.1-cp39-cp39-win_amd64.whl", hash = "sha256:dee60e1de1898bde3b238f18340eec6148986da0455d8ba7848d50470a7a32fb"}, {file = "wrapt-1.14.1.tar.gz", hash = "sha256:380a85cf89e0e69b7cfbe2ea9f765f004ff419f34194018a6827ac0e3edfed4d"}, ] -zipp = [ - {file = "zipp-3.8.1-py3-none-any.whl", hash = "sha256:47c40d7fe183a6f21403a199b3e4192cca5774656965b0a4988ad2f8feb5f009"}, - {file = "zipp-3.8.1.tar.gz", hash = "sha256:05b45f1ee8f807d0cc928485ca40a07cb491cf092ff587c0df9cb1fd154848d2"}, -] diff --git a/pyproject.toml b/pyproject.toml index 78d22b4..88e1814 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django_example_ynh" -version = "0.4.1+ynh1" +version = "0.5.0rc1+ynh1" description = "Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost." authors = ["JensDiemer "] license = "GPL" @@ -10,11 +10,14 @@ homepage = "https://github.com/YunoHost-Apps/django_example_ynh" "Bug Tracker" = "https://github.com/YunoHost-Apps/django_example_ynh/issues" [tool.poetry.dependencies] -python = ">=3.7,<4.0.0" # TODO: Update to >=3.8 after YunoHost updates to Bullseye +python = ">=3.9,<4.0.0" # Stay with 3.9 until YunoHost used >=Debian 11 (Bullseye) + +django-example = ">=0.1.0rc0" # https://github.com/jedie/django-example # extras "ynh" will install: gunicorn, psycopg2, django-redis and django-axes # see: https://github.com/YunoHost-Apps/django_yunohost_integration/blob/main/pyproject.toml -django_yunohost_integration = {version = ">=0.4.1", extras = ["ynh"]} # https://github.com/YunoHost-Apps/django_yunohost_integration +django_yunohost_integration = {version = ">=0.5.0rc1", extras = ["ynh"]} # https://github.com/YunoHost-Apps/django_yunohost_integration + [tool.poetry.dev-dependencies] bx_py_utils = "*" # https://github.com/boxine/bx_py_utils @@ -31,6 +34,7 @@ EditorConfig = "*" # https://github.com/editorconfig/editorconfig-core-py safety = "*" # https://github.com/pyupio/safety requests = "*" # https://github.com/psf/requests packaging = "*" # https://github.com/pypa/packagi +beautifulsoup4 = "*" # https://pypi.org/project/beautifulsoup4/ [build-system] @@ -100,7 +104,7 @@ omit = [".*"] legacy_tox_ini = """ [tox] isolated_build = True -envlist = py{37,38,39,310} +envlist = py{39,310} skip_missing_interpreters = True [testenv] diff --git a/scripts/_common.sh b/scripts/_common.sh index 24083aa..b14c5d7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,6 +11,10 @@ admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME +# Transfer the main SSO domain to the App: +ynh_current_host=$(cat /etc/yunohost/current_host) +__YNH_CURRENT_HOST__=${ynh_current_host} + #================================================= # ARGUMENTS FROM CONFIG PANEL #================================================= diff --git a/tests/test_django_project.py b/tests/test_django_project.py index 82b6b4f..c4f7862 100644 --- a/tests/test_django_project.py +++ b/tests/test_django_project.py @@ -7,7 +7,6 @@ from django.test.testcases import TestCase from django.urls.base import reverse from django_yunohost_integration.test_utils import generate_basic_auth -from django_yunohost_integration.views import request_media_debug_view @override_settings(DEBUG=False) @@ -34,45 +33,25 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase): assert settings.ADMIN_EMAIL == 'foo-bar@test.tld' assert settings.DEFAULT_FROM_EMAIL == 'django_app@test.tld' - def test_request_media_debug_view(self): - assert reverse(request_media_debug_view) == '/app_path/debug/' - - self.client.cookies['SSOwAuthUser'] = 'test' - kwargs = dict( - path='/app_path/debug/', - HTTP_REMOTE_USER='test', - HTTP_AUTH_USER='test', - HTTP_AUTHORIZATION='basic dGVzdDp0ZXN0MTIz', - secure=True, - ) - assert settings.DEBUG is False - with self.assertRaisesMessage(AssertionError, 'Only in DEBUG mode available!'): - self.client.get(**kwargs) - - with override_settings(DEBUG=True): - response = self.client.get(**kwargs) - self.assert_html_parts( - response, - parts=('request.META',), - ) - def test_auth(self): assert settings.PATH_URL == 'app_path' - assert reverse('admin:index') == '/app_path/' + assert reverse('admin:index') == '/app_path/admin/' # SecurityMiddleware should redirects all non-HTTPS requests to HTTPS: assert settings.SECURE_SSL_REDIRECT is True - response = self.client.get('/app_path/', secure=False) + response = self.client.get('/app_path/admin/', secure=False) self.assertRedirects( response, status_code=301, # permanent redirect - expected_url='https://testserver/app_path/', + expected_url='https://testserver/app_path/admin/', fetch_redirect_response=False, ) - response = self.client.get('/app_path/', secure=True) + response = self.client.get('/app_path/admin/', secure=True) self.assertRedirects( - response, expected_url='/app_path/login/?next=/app_path/', fetch_redirect_response=False + response, + expected_url='/app_path/admin/login/?next=%2Fapp_path%2Fadmin%2F', + fetch_redirect_response=False, ) def test_create_unknown_user(self): @@ -81,7 +60,7 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase): self.client.cookies['SSOwAuthUser'] = 'test' response = self.client.get( - path='/app_path/', + path='/app_path/admin/', HTTP_REMOTE_USER='test', HTTP_AUTH_USER='test', HTTP_AUTHORIZATION='basic dGVzdDp0ZXN0MTIz', @@ -98,7 +77,7 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase): self.assert_html_parts( response, parts=( - '

Django administration

', + '

Django administration

', 'test', ), ) @@ -110,7 +89,7 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase): self.client.cookies['SSOwAuthUser'] = 'test' response = self.client.get( - path='/app_path/', + path='/app_path/admin/', HTTP_REMOTE_USER='test', HTTP_AUTH_USER='foobar', # <<< wrong user name HTTP_AUTHORIZATION='basic dGVzdDp0ZXN0MTIz', diff --git a/tests/test_example_project.py b/tests/test_example_project.py new file mode 100644 index 0000000..5b361d4 --- /dev/null +++ b/tests/test_example_project.py @@ -0,0 +1,66 @@ +import os + +from bx_django_utils.test_utils.html_assertion import ( + HtmlAssertionMixin, + assert_html_response_snapshot, +) +from django.conf import settings +from django.test.testcases import TestCase +from django.urls.base import reverse +from django_example import __version__ + + +class ExampleProjectTestCase(HtmlAssertionMixin, TestCase): + def test_urls(self): + assert settings.PATH_URL == 'app_path' + assert reverse('admin:index') == '/app_path/admin/' + assert reverse('debug-view') == '/app_path/' + + ############################################################################### + # Test as anonymous user + + with self.assertLogs('django_example') as logs: + response = self.client.get( + path='/app_path/', + secure=True, + ) + self.assert_html_parts( + response, + parts=( + f'

YunoHost Django Example Project v{__version__}

', + '

Go to Django Admin.

', + '

Log in to see more information

', + 'User:AnonymousUser', + 'META:', + ), + ) + self.assertEqual( + logs.output, ['INFO:django_example.views:DebugView request from user: AnonymousUser'] + ) + assert_html_response_snapshot(response, query_selector='#container', validate=False) + + ############################################################################### + # Test as SSO user + + self.client.cookies['SSOwAuthUser'] = 'test' + + with self.assertLogs('django_example') as logs: + response = self.client.get( + path='/app_path/', + HTTP_REMOTE_USER='test', + HTTP_AUTH_USER='test', + HTTP_AUTHORIZATION='basic dGVzdDp0ZXN0MTIz', + secure=True, + ) + self.assert_html_parts( + response, + parts=( + f'

YunoHost Django Example Project v{__version__}

', + '

Go to Django Admin.

', + 'User:test', + f'Process ID:{os.getpid()}', + ), + ) + self.assertEqual( + logs.output, ['INFO:django_example.views:DebugView request from user: test'] + ) diff --git a/tests/test_example_project_urls_1.snapshot.html b/tests/test_example_project_urls_1.snapshot.html new file mode 100644 index 0000000..8ee5cc0 --- /dev/null +++ b/tests/test_example_project_urls_1.snapshot.html @@ -0,0 +1,143 @@ +
+ + + + +
+
+ +
+

+ YunoHost Django Example Project v0.1.0rc0 +

+

+ Go to + + Django Admin + + . +

+

+ Log in to see more information +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + settings.SETTINGS_MODULE + + : + + + settings + +
+ Env. type: + + + None + +
+ User: + + AnonymousUser +
+ Process User: + + (ID: :) +
+ Executable: + +
+ Process ID: + +
+ Python Version: + +
+ Sys prefix: + +
+ Current work dir: + +
+ OS uname: + +
+ OS Environment: + +
+ META: + +
+
+
+ +
+

+ + github.com/jedie/django-example + +

+
+
+
\ No newline at end of file