documentation et petits correctifs pour une installation locale #122

Closed
ctactic wants to merge 10 commits from ctactic:fix-localinstall into develop-1.0
6 changed files with 55 additions and 32 deletions

3
.gitignore vendored
View File

@ -5,3 +5,6 @@ venv/
node_modules/
*.egg-info/
*.egg
db.sqlite3
instance/settings/settings.py

View File

@ -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,7 +14,43 @@ This project is distributed under GPL version 3. More information in the LICENSE
* **cms**: content management system.
## Scripts
## 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 :
```
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
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
```
## 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`:
@ -27,7 +62,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
@ -62,8 +96,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.

View File

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

View File

@ -7,6 +7,10 @@ try:
except ImportError:
pass
DEBUG = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-+@*g!emsz-!6sr8a2z&sighsc8m+1(+oq+#+nne+-txd3^l59t'
Review

SECRET_KEY should not be present in repo files.

SECRET_KEY should not be present in repo files.
LOCALE_PATHS = ["aircox/locale", "aircox_streamer/locale"]
@ -40,3 +44,9 @@ LOGGING = {
},
},
}
CACHES = {
Review

Cache is disabled on dev

Cache is disabled on dev
"default": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
}
}

View File

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

Already imported in instance.settings.base

Already imported in `instance.settings.base`
Review

Here is the traceback I get when I try to load settings.dev :

DJANGO_SETTINGS_MODULE=instance.settings.dev ./manage.py runserver

Traceback (most recent call last):
  File "/home/chris/src/aircox/./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 382, in execute
    settings.INSTALLED_APPS
  File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 102, in __getattr__
    self._setup(name)
  File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 89, in _setup
    self._wrapped = Settings(settings_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 217, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/chris/src/aircox/instance/settings/__init__.py", line 1, in <module>
    from .settings import *
  File "/home/chris/src/aircox/instance/settings/settings.py", line 25, in <module>
    timezone.activate(ZoneInfo(TIME_ZONE))
    ^^^^^^^^
NameError: name 'timezone' is not defined
Here is the traceback I get when I try to load settings.dev : ``` DJANGO_SETTINGS_MODULE=instance.settings.dev ./manage.py runserver Traceback (most recent call last): File "/home/chris/src/aircox/./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 382, in execute settings.INSTALLED_APPS File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 102, in __getattr__ self._setup(name) File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 89, in _setup self._wrapped = Settings(settings_module) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/chris/src/aircox/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 217, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1204, in _gcd_import File "<frozen importlib._bootstrap>", line 1176, in _find_and_load File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1204, in _gcd_import File "<frozen importlib._bootstrap>", line 1176, in _find_and_load File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 690, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/home/chris/src/aircox/instance/settings/__init__.py", line 1, in <module> from .settings import * File "/home/chris/src/aircox/instance/settings/settings.py", line 25, in <module> timezone.activate(ZoneInfo(TIME_ZONE)) ^^^^^^^^ NameError: name 'timezone' is not defined ```
from zoneinfo import ZoneInfo
from .prod import *

View File

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