From c40118978b277a2c380b6a8409c1f321e8a94ca4 Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Thu, 28 Sep 2023 12:29:57 +0200 Subject: [PATCH 01/11] dependencies: bump pyyaml version to 6.0.1 (enables wheel building in a CPython3.11.2 virtualenv, https://github.com/yaml/pyyaml/issues/601) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 65bdec7..7fcf089 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,5 +17,5 @@ dateutils~=0.6 mutagen~=1.45 Pillow~=9.0 psutil~=5.9 -PyYAML==5.4 +PyYAML==6.0.1 watchdog~=2.1 -- 2.30.2 From f482a5732f8169ad9e7e851ec1fc985ae3841518 Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Thu, 28 Sep 2023 12:49:33 +0200 Subject: [PATCH 02/11] documentation: update settings file location --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7362de1..a07ca2a 100755 --- a/README.md +++ b/README.md @@ -62,8 +62,8 @@ pip install -r requirements.txt ``` ### Configuration -You must write a settings.py file in the `instance` directory (you can just -copy and paste `instance/sample_settings.py`. There still is configuration +You must write a settings.py file in the `instance/settings` directory (you can just +copy and paste `instance/settings/sample.py`. There still is configuration required in this file, check it in for more info. -- 2.30.2 From 48c5a1c9ce5c9110536d9ee0cd7717c6e6f6da3e Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Thu, 28 Sep 2023 12:50:02 +0200 Subject: [PATCH 03/11] gitignore: ignore db.sqlite3 and instance/settings/settings.py --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index fd1ca31..e78eae4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ venv/ node_modules/ *.egg-info/ *.egg + +db.sqlite3 +instance/settings/settings.py -- 2.30.2 From 5119ef5f44e10599979d890068ab6df8746fea5a Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Thu, 28 Sep 2023 12:54:05 +0200 Subject: [PATCH 04/11] settings: prevent ModuleNotFoundError --- instance/settings/sample.py | 1 + 1 file changed, 1 insertion(+) diff --git a/instance/settings/sample.py b/instance/settings/sample.py index 1edb036..0904565 100644 --- a/instance/settings/sample.py +++ b/instance/settings/sample.py @@ -10,6 +10,7 @@ For Django settings see: https://docs.djangoproject.com/en/3.1/topics/settings/ https://docs.djangoproject.com/en/3.1/ref/settings/ """ +from django.utils import timezone from zoneinfo import ZoneInfo from .prod import * -- 2.30.2 From f426e215417b861bdb2dae1fe28cdd51e2ab4887 Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Thu, 28 Sep 2023 12:57:51 +0200 Subject: [PATCH 05/11] settings/dev: do not require memcached --- instance/settings/dev.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/instance/settings/dev.py b/instance/settings/dev.py index 44d1d29..601da35 100755 --- a/instance/settings/dev.py +++ b/instance/settings/dev.py @@ -40,3 +40,9 @@ LOGGING = { }, }, } + +CACHES = { + "default": { + "BACKEND": "django.core.cache.backends.locmem.LocMemCache", + } +} -- 2.30.2 From ac591fa0e4f467a4f846389aaf729eaf6b9910ba Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Thu, 28 Sep 2023 13:34:41 +0200 Subject: [PATCH 06/11] documentation: add a development setup section --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index a07ca2a..62fdf0c 100755 --- a/README.md +++ b/README.md @@ -15,6 +15,31 @@ This project is distributed under GPL version 3. More information in the LICENSE * **cms**: content management system. +## Development setup +Start installing a virtual environment : + +``` +virtualenv venv +source venv/bin/activate +pip install -r requirements.txt +pip install -r requirements_tests.txt +``` + +Then copy the default settings and initiate the database : + +``` +cp instance/settings/sample.py instance/settings/settings.py +python -c "from django.core.management.utils import get_random_secret_key; print('SECRET_KEY = \"%s\"' % get_random_secret_key())" >> instance/settings/settings.py +DJANGO_SETTINGS_MODULE=instance.settings.dev ./manage.py migrate +``` + +Finally test and run the instance using development settings, and point your browser to http://localhost:8000 : + +``` +DJANGO_SETTINGS_MODULE=instance.settings.dev pytest +DJANGO_SETTINGS_MODULE=instance.settings.dev ./manage.py runserver +``` + ## Scripts Are included various configuration scripts that can be used to ease setup. They assume that the project is present in `/srv/apps/aircox`: -- 2.30.2 From 8ef347c41307f772bf3912ac5182423659b06e28 Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Thu, 28 Sep 2023 13:35:53 +0200 Subject: [PATCH 07/11] documentation: move the scripts subsection into installation --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 62fdf0c..0f88411 100755 --- a/README.md +++ b/README.md @@ -40,7 +40,8 @@ DJANGO_SETTINGS_MODULE=instance.settings.dev pytest DJANGO_SETTINGS_MODULE=instance.settings.dev ./manage.py runserver ``` -## Scripts +## Installation +### Scripts Are included various configuration scripts that can be used to ease setup. They assume that the project is present in `/srv/apps/aircox`: @@ -52,7 +53,6 @@ The scripts are written with a combination of `cron`, `supervisord`, `nginx` and `gunicorn` in mind. -## Installation ### Dependencies For python dependencies take a peek at the `requirements.txt` file, plus dependencies specific to Django (e.g. for database: `mysqlclient` for MySql -- 2.30.2 From 608bf9d4399fc42ca7d7866a0216b4887120c705 Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Thu, 28 Sep 2023 13:47:03 +0200 Subject: [PATCH 08/11] settings/dev: switch on debug mode (and get static files served) --- instance/settings/dev.py | 1 + 1 file changed, 1 insertion(+) diff --git a/instance/settings/dev.py b/instance/settings/dev.py index 601da35..e1646c5 100755 --- a/instance/settings/dev.py +++ b/instance/settings/dev.py @@ -7,6 +7,7 @@ try: except ImportError: pass +DEBUG = True LOCALE_PATHS = ["aircox/locale", "aircox_streamer/locale"] -- 2.30.2 From dfcc36e5d9bf742dedb62d5d36dedca7c70a5926 Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Thu, 28 Sep 2023 14:03:30 +0200 Subject: [PATCH 09/11] documenation: merge technicians content --- README.md | 14 ++++++++++++-- docs/technicians.md | 25 ------------------------- 2 files changed, 12 insertions(+), 27 deletions(-) delete mode 100755 docs/technicians.md diff --git a/README.md b/README.md index 0f88411..1e73868 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ ![](/logo.png) -Platform to manage a radio, schedules, website, and so on. We use the power of great tools like Django or Liquidsoap. +A platform to manage radio schedules, website content, and more. It uses the power of great tools like Django or Liquidsoap. This project is distributed under GPL version 3. More information in the LICENSE file, except for some files whose license is indicated inside source code. - ## Features * **streams**: multiple random music streams when no program is played. We also can specify a time range and frequency for each; * **diffusions**: generate diffusions time slot for programs that have schedule informations. Check for conflicts and rerun. @@ -15,6 +14,11 @@ This project is distributed under GPL version 3. More information in the LICENSE * **cms**: content management system. +## Architecture and concepts +Aircox is divided in two main modules: +* `aircox`: basics of Aircox (programs, diffusions, sounds, etc. management); interface for managing a website with Aircox elements (playlists, timetable, players on the website); +* `aircox_streamer`: interact with application to generate audio stream (LiquidSoap); + ## Development setup Start installing a virtual environment : @@ -41,6 +45,12 @@ DJANGO_SETTINGS_MODULE=instance.settings.dev ./manage.py runserver ``` ## Installation +Running Aircox on production involves: +* Aircox modules and a running Django project; +* a supervisor for common tasks (sounds monitoring, stream control, etc.) -- `supervisord`; +* a wsgi and an HTTP server -- `gunicorn`, `nginx`; +* a database supported by Django (MySQL, SQLite, PostGresSQL); + ### Scripts Are included various configuration scripts that can be used to ease setup. They assume that the project is present in `/srv/apps/aircox`: diff --git a/docs/technicians.md b/docs/technicians.md deleted file mode 100755 index 6efab8b..0000000 --- a/docs/technicians.md +++ /dev/null @@ -1,25 +0,0 @@ - -# General information -Aircox is a set of Django applications that aims to provide a radio management solution, and is -written in Python 3.5. - -Running Aircox on production involves: -* Aircox modules and a running Django project; -* a supervisor for common tasks (sounds monitoring, stream control, etc.) -- `supervisord`; -* a wsgi and an HTTP server -- `gunicorn`, `nginx`; -* a database supported by Django (MySQL, SQLite, PostGresSQL); - -# Architecture and concepts -Aircox is divided in three main modules: -* `programs`: basics of Aircox (programs, diffusions, sounds, etc. management); -* `controllers`: interact with application to generate audio stream (LiquidSoap); -* `cms`: create a website with Aircox elements (playlists, timetable, players on the website); - - - - - -# Installation - - -# Configuration -- 2.30.2 From b771fbd593f2ad1c684bcf70f5259fb530ea311e Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Mon, 2 Oct 2023 10:12:50 +0200 Subject: [PATCH 10/11] settings/dev: set root logger level to debug and show module name --- instance/settings/dev.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/instance/settings/dev.py b/instance/settings/dev.py index e1646c5..904cb67 100755 --- a/instance/settings/dev.py +++ b/instance/settings/dev.py @@ -16,7 +16,7 @@ LOGGING = { "disable_existing_loggers": False, "formatters": { "timestamp": { - "format": "{asctime} {levelname} {message}", + "format": "{asctime} {module} {levelname} {message}", "style": "{", }, }, @@ -27,6 +27,10 @@ LOGGING = { }, }, "loggers": { + "root": { + "handlers": ["console"], + "level": os.getenv("DJANGO_LOG_LEVEL", "DEBUG"), + }, "aircox": { "handlers": ["console"], "level": os.getenv("DJANGO_LOG_LEVEL", "DEBUG"), -- 2.30.2 From 92fe9d5ad375951cbfc491efb9e03ad145fc43d4 Mon Sep 17 00:00:00 2001 From: Christophe Siraut Date: Mon, 16 Oct 2023 10:04:20 +0200 Subject: [PATCH 11/11] documentation: advice pre-commit installation --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 1e73868..88fdcd3 100755 --- a/README.md +++ b/README.md @@ -44,6 +44,13 @@ DJANGO_SETTINGS_MODULE=instance.settings.dev pytest DJANGO_SETTINGS_MODULE=instance.settings.dev ./manage.py runserver ``` +Before requesting a merge, enable pre-commit : + +``` +pip install pre-commit +pre-commit install +``` + ## Installation Running Aircox on production involves: * Aircox modules and a running Django project; -- 2.30.2