django_example_ynh/README_fr.md

226 lines
10 KiB
Markdown
Raw Normal View History

2022-08-12 18:18:29 +02:00
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Django Example pour YunoHost
2023-04-12 20:14:41 +02:00
[![Niveau dintégration](https://dash.yunohost.org/integration/django_example.svg)](https://dash.yunohost.org/appci/app/django_example) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/django_example.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/django_example.maintain.svg)
[![Installer Django Example avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=django_example)
2022-08-12 18:18:29 +02:00
*[Read this readme in english.](./README.md)*
2023-04-12 20:14:41 +02:00
> *Ce package vous permet dinstaller Django Example rapidement et simplement sur un serveur YunoHost.
Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
2022-08-12 18:18:29 +02:00
2023-04-12 20:14:41 +02:00
## Vue densemble
2022-08-12 18:18:29 +02:00
2022-12-21 20:11:06 +01:00
[![tests](https://github.com/YunoHost-Apps/django_example_ynh/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/YunoHost-Apps/django_example_ynh/actions/workflows/tests.yml)
[![codecov](https://codecov.io/github/jedie/django_example_ynh/branch/main/graph/badge.svg)](https://codecov.io/github/jedie/django_example_ynh)
[![django_example_ynh @ PyPi](https://img.shields.io/pypi/v/django_example_ynh?label=django_example_ynh%20%40%20PyPi)](https://pypi.org/project/django_example_ynh/)
[![Python Versions](https://img.shields.io/pypi/pyversions/django_example_ynh)](https://github.com/YunoHost-Apps/django_example_ynh/blob/main/pyproject.toml)
[![License GPL-3.0](https://img.shields.io/pypi/l/django_example_ynh)](https://github.com/YunoHost-Apps/django_example_ynh/blob/main/LICENSE)
2022-08-14 17:50:29 +02:00
2022-10-04 09:32:03 +02:00
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).
2022-08-14 17:50:29 +02:00
2022-10-06 17:32:24 +02:00
To demonstrate the functionality the small [django-example](https://github.com/jedie/django-example) app will be installed.
2022-08-14 17:50:29 +02:00
[![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)
Pull requests welcome ;)
2023-08-22 08:39:17 +02:00
**Version incluse :** 0.2.0~ynh2
2022-08-14 17:50:29 +02:00
## Avertissements / informations importantes
## local test
For quicker developing of django_example_ynh in the context of YunoHost app,
it's possible to run the Django developer server with the settings
and urls made for YunoHost installation.
e.g.:
```bash
2023-08-22 08:39:17 +02:00
~$ git clone https://github.com/YunoHost-Apps/django_example.git
2022-08-14 17:50:29 +02:00
~$ cd django_example_ynh/
2023-08-22 08:39:17 +02:00
~/django_example$ make
2022-08-14 17:50:29 +02:00
install-poetry install or update poetry
install install project via poetry
update update the sources and installation and generate "conf/requirements.txt"
lint Run code formatters and linter
fix-code-style Fix code formatting
tox-listenvs List all tox test environments
tox Run pytest via tox with all environments
pytest Run pytest
publish Release new version to PyPi
local-test Run local_test.py to run the project locally
local-diff-settings Run "manage.py diffsettings" with local test
2023-08-22 08:39:17 +02:00
~/django_example$ make install-poetry
~/django_example$ make install
~/django_example$ make local-test
2022-08-14 17:50:29 +02:00
```
Notes:
* SQlite database will be used
* A super user with username `test` and password `test` is created
* The page is available under `http://127.0.0.1:8000/app_path/`
## history
2023-08-22 08:39:17 +02:00
* [compare v0.1.5...master](https://github.com/YunoHost-Apps/django_example/compare/v0.2.0...master) **dev**
2022-08-14 17:50:29 +02:00
* tbc
2023-08-22 08:39:17 +02:00
* [v0.2.0 - 15.09.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.5...v0.2.0)
2022-08-14 17:50:29 +02:00
* rename/split `django_example_ynh` into:
* [django_yunohost_integration](https://github.com/jedie/django_yunohost_integration) - Python package with the glue code to integrate a Django project with YunoHost
2023-08-22 08:39:17 +02:00
* [django_example_ynh](https://github.com/YunoHost-Apps/django_example) - Demo YunoHost App to demonstrate the integration of a Django project under YunoHost
* [v0.1.5 - 19.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.4...v0.1.5)
2022-08-14 17:50:29 +02:00
* Make some deps `gunicorn`, `psycopg2-binary`, `django-redis`, `django-axes` optional
2023-08-22 08:39:17 +02:00
* [v0.1.4 - 08.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.3...v0.1.4)
* Bugfix [CSRF verification failed on POST requests #7](https://github.com/YunoHost-Apps/django_example/issues/7)
* [v0.1.3 - 08.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.2...v0.1.3)
2022-08-14 17:50:29 +02:00
* set "DEBUG = True" in local_test (so static files are served and auth works)
* Bugfixes and cleanups
2023-08-22 08:39:17 +02:00
* [v0.1.2 - 29.12.2020](https://github.com/YunoHost-Apps/django_example/compare/v0.1.1...v0.1.2)
2022-08-14 17:50:29 +02:00
* Bugfixes
2023-08-22 08:39:17 +02:00
* [v0.1.1 - 29.12.2020](https://github.com/YunoHost-Apps/django_example/compare/v0.1.0...v0.1.1)
2022-08-14 17:50:29 +02:00
* Refactor "create_superuser" to a manage command, useable via "django_example_ynh" in `INSTALLED_APPS`
* Generate "conf/requirements.txt" and use this file for install
* rename own settings and urls (in `/conf/`)
2023-08-22 08:39:17 +02:00
* [v0.1.0 - 28.12.2020](https://github.com/YunoHost-Apps/django_example/compare/f578f14...v0.1.0)
2022-08-14 17:50:29 +02:00
* first working state
2023-08-22 08:39:17 +02:00
* [23.12.2020](https://github.com/YunoHost-Apps/django_example/commit/f578f144a3a6d11d7044597c37d550d29c247773)
2022-08-14 17:50:29 +02:00
* init the project
## Links
2023-08-22 08:39:17 +02:00
* Report a bug about this package: https://github.com/YunoHost-Apps/django_example
2022-08-14 17:50:29 +02:00
* YunoHost website: https://yunohost.org/
* PyPi package: https://pypi.org/project/django-ynh/
These projects used `django_example_ynh`:
2023-08-22 08:39:17 +02:00
* https://github.com/YunoHost-Apps/django_example
2022-08-14 17:50:29 +02:00
* https://github.com/YunoHost-Apps/django-for-runners_ynh
---
# Developer info
2023-08-22 08:39:17 +02:00
The App project will be stored under `__DATA_DIR__` (e.g.: `/home/yunohost.app/$app/`) that's Django's `settings.DATA_DIR_PATH`
"static" / "media" files to serve via nginx are under `__INSTALL_DIR__` (e.g.: `/var/www/$app/`) that's `settings.INSTALL_DIR_PATH`
2022-08-14 17:50:29 +02:00
## package installation / debugging
This app is not in YunoHost app catalog. Test install, e.g.:
```bash
~# git clone https://github.com/YunoHost-Apps/django_example_ynh.git
~# yunohost app install django_example_ynh/ -f
```
To update:
```bash
~# cd django_example_ynh
~/django_example_ynh# git fetch && git reset --hard origin/testing
2023-08-22 08:39:17 +02:00
~/django_example_ynh# yunohost app upgrade django_example -u . -F
2022-08-14 17:50:29 +02:00
```
To remove call e.g.:
```bash
2023-08-22 08:39:17 +02:00
sudo yunohost app remove django_example
2022-08-14 17:50:29 +02:00
```
Backup / remove / restore cycle, e.g.:
```bash
2023-08-22 08:39:17 +02:00
yunohost backup create --apps django_example
2022-08-14 17:50:29 +02:00
yunohost backup list
archives:
- django_example_ynh-pre-upgrade1
2023-08-22 08:39:17 +02:00
- 20230822-062848
yunohost app remove django_example
yunohost backup restore 20230822-062848 --apps django_example
2022-08-14 17:50:29 +02:00
```
Debug the installation, e.g.:
```bash
2023-08-22 08:39:17 +02:00
root@yunohost:~# cat /etc/yunohost/apps/django_example/settings.yml
...
app: django_example
...
data_dir: /home/yunohost.app/django_example
...
install_dir: /var/www/django_example
...
log_file: /var/log/django_example/django_example.log
2022-08-14 20:40:41 +02:00
...
2023-08-22 08:39:17 +02:00
root@yunohost:~# ls -la /var/www/django_example/
2022-08-14 17:50:29 +02:00
total 18
drwxr-xr-x 4 root root 4 Dec 8 08:36 .
drwxr-xr-x 6 root root 6 Dec 8 08:36 ..
drwxr-xr-x 2 root root 2 Dec 8 08:36 media
drwxr-xr-x 7 root root 8 Dec 8 08:40 static
2023-08-22 08:39:17 +02:00
root@yunohost:~# ls -la /home/yunohost.app/django_example/
2022-08-14 17:50:29 +02:00
total 58
drwxr-xr-x 5 django_example_ynh django_example_ynh 11 Dec 8 08:39 .
drwxr-xr-x 3 root root 3 Dec 8 08:36 ..
-rw-r--r-- 1 django_example_ynh django_example_ynh 460 Dec 8 08:39 gunicorn.conf.py
-rw-r--r-- 1 django_example_ynh django_example_ynh 0 Dec 8 08:39 local_settings.py
-rwxr-xr-x 1 django_example_ynh django_example_ynh 274 Dec 8 08:39 manage.py
-rw-r--r-- 1 django_example_ynh django_example_ynh 171 Dec 8 08:39 secret.txt
drwxr-xr-x 6 django_example_ynh django_example_ynh 6 Dec 8 08:37 venv
-rw-r--r-- 1 django_example_ynh django_example_ynh 115 Dec 8 08:39 wsgi.py
-rw-r--r-- 1 django_example_ynh django_example_ynh 4737 Dec 8 08:39 django_example_ynh_demo_settings.py
2023-08-22 08:39:17 +02:00
root@yunohost:~# /home/yunohost.app/django_example/manage.py diffsettings
...
root@yunohost:~# /home/yunohost.app/django_example/manage.py check
ENV_TYPE:None
PROJECT_PATH:/home/yunohost.app/django_example/venv/lib/python3.9/site-packages
BASE_PATH:/root/django_example
2022-08-14 17:50:29 +02:00
System check identified no issues (0 silenced).
2023-08-22 08:39:17 +02:00
root@yunohost:~# cat /etc/systemd/system/django_example.service
...
root@yunohost:~# systemctl reload-or-restart django_example
root@yunohost:~# journalctl --unit=django_example --follow
...
root@yunohost:~# tail -f /var/log/django_example/django_example.log
...
root@yunohost:~# tail -f /var/log/nginx/*.log
2022-08-14 20:40:41 +02:00
...
2022-08-14 17:50:29 +02:00
2023-08-22 08:39:17 +02:00
root@yunohost:~# ls -la /etc/nginx/conf.d/
root@yunohost:~# cat /etc/nginx/conf.d/$domain.d/django_example.conf
2022-08-14 17:50:29 +02:00
```
2022-08-12 18:18:29 +02:00
## Documentations et ressources
2022-12-21 20:11:06 +01:00
* Documentation officielle utilisateur : <https://github.com/jedie/django-example>
2023-06-11 15:55:11 +02:00
* Documentation officielle de ladmin : <https://github.com/YunoHost-Apps/django_example_ynh>
* Dépôt de code officiel de lapp : <https://github.com/YunoHost-Apps/django_example_ynh>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_django_example>
* Signaler un bug : <https://github.com/YunoHost-Apps/django_example_ynh/issues>
2022-08-12 18:18:29 +02:00
## Informations pour les développeurs
2023-04-12 20:14:41 +02:00
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/django_example_ynh/tree/testing).
2022-08-12 18:18:29 +02:00
Pour essayer la branche testing, procédez comme suit.
``` bash
2023-04-12 20:14:41 +02:00
sudo yunohost app install https://github.com/YunoHost-Apps/django_example_ynh/tree/testing --debug
2022-08-12 18:18:29 +02:00
ou
2023-04-12 20:14:41 +02:00
sudo yunohost app upgrade django_example -u https://github.com/YunoHost-Apps/django_example_ynh/tree/testing --debug
2022-08-12 18:18:29 +02:00
```
2023-08-22 08:39:17 +02:00
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>