Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost.
Find a file
2022-01-19 09:11:54 +01:00
.github/workflows get pytest running with local test copy 2020-12-28 18:52:29 +01:00
conf cleanup 2021-09-15 19:16:35 +02:00
scripts Tweak ynh_script_progression weights 2022-01-19 09:11:54 +01:00
tests cleanup 2021-09-15 19:16:35 +02:00
.editorconfig init 2020-12-23 19:58:33 +01:00
.flake8 WIP: rename/split from django_ynh 2021-02-28 12:07:48 +01:00
.gitignore WIP: rename/split from django_ynh 2021-02-28 12:07:48 +01:00
check_process init 2020-12-23 19:58:33 +01:00
LICENSE init 2020-12-23 19:58:33 +01:00
local_test.py cleanup 2021-09-15 19:16:35 +02:00
Makefile WIP: rename/split from django_ynh 2021-02-28 12:07:48 +01:00
manifest.json Remove "ask" entries 2022-01-19 09:09:07 +01:00
poetry.lock cleanup 2021-09-15 19:16:35 +02:00
pyproject.toml cleanup 2021-09-15 19:16:35 +02:00
README.md cleanup 2021-09-15 19:16:35 +02:00
run_pytest.py cleanup 2021-09-15 19:16:35 +02:00

django_example_ynh

Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost.

Integration level Install django_example_ynh with YunoHost

Pull requests welcome ;)

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.:

~$ git clone https://github.com/YunoHost-Apps/django_example_ynh.git
~$ cd django_example_ynh/
~/django_example_ynh$ make
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

~/django_example_ynh$ make install-poetry
~/django_example_ynh$ make install
~/django_example_ynh$ make local-test

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

These projects used django_example_ynh:


Developer info

package installation / debugging

Please send your pull request to https://github.com/YunoHost-Apps/django_example_ynh

Try 'main' branch, e.g.:

sudo yunohost app install https://github.com/YunoHost-Apps/django_example_ynh/tree/master --debug
or
sudo yunohost app upgrade django_example_ynh -u https://github.com/YunoHost-Apps/django_example_ynh/tree/master --debug

Try 'testing' branch, e.g.:

sudo yunohost app install https://github.com/YunoHost-Apps/django_example_ynh/tree/testing --debug
or
sudo yunohost app upgrade django_example_ynh -u https://github.com/YunoHost-Apps/django_example_ynh/tree/testing --debug

To remove call e.g.:

sudo yunohost app remove django_example_ynh

Backup / remove / restore cycle, e.g.:

yunohost backup create --apps django_example_ynh
yunohost backup list
archives:
  - django_example_ynh-pre-upgrade1
  - 20201223-163434
yunohost app remove django_example_ynh
yunohost backup restore 20201223-163434 --apps django_example_ynh

Debug installation, e.g.:

root@yunohost:~# ls -la /var/www/django_example_ynh/
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

root@yunohost:~# ls -la /opt/yunohost/django_example_ynh/
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

root@yunohost:~# cd /opt/yunohost/django_example_ynh/
root@yunohost:/opt/yunohost/django_example_ynh# source venv/bin/activate
(venv) root@yunohost:/opt/yunohost/django_example_ynh# ./manage.py check
django_example_ynh v0.8.2 (Django v2.2.17)
DJANGO_SETTINGS_MODULE='django_example_ynh_demo_settings'
PROJECT_PATH:/opt/yunohost/django_example_ynh/venv/lib/python3.7/site-packages
BASE_PATH:/opt/yunohost/django_example_ynh
System check identified no issues (0 silenced).

root@yunohost:~# tail -f /var/log/django_example_ynh/django_example_ynh.log
root@yunohost:~# cat /etc/systemd/system/django_example_ynh.service

root@yunohost:~# systemctl reload-or-restart django_example_ynh
root@yunohost:~# journalctl --unit=django_example_ynh --follow