Skip to content

Files

Latest commit

2def663 · Jul 5, 2024

History

History
This branch is 52 commits ahead of Sispheor/piclodio3:master.

back

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 8, 2020
Apr 11, 2020
Jul 5, 2024
Jul 5, 2024
Jul 5, 2024
Jul 5, 2024
Jun 6, 2023
Apr 10, 2020
Mar 24, 2023
Mar 24, 2023
Jun 27, 2024
Mar 24, 2023
Jul 5, 2024
Jun 27, 2024
Jul 5, 2024
Feb 13, 2022

RadioGaGa 3 backend

Development installation

System packages

sudo apt install sqlite3

Create a dedicated python env

cd back
virtualenv venv -p python3.7
source venvtest/bin/activate

Install python packages

pip3 install -r requirements.txt

Run dev server

python3 manage.py runserver

Run tests

python3 manage.py test

Production server

Switch the server to prod mode by editing the file back/radiogaga/settings.py and update the line that correspond to the debug

DEBUG = False

Run the prod server

gunicorn --bind 0.0.0.0:8000 radiogaga.wsgi:application

Automatically at each startup with systemd (Prod)

Create and open a Systemd service file for Gunicorn with sudo privileges in your text editor:

sudo nano /etc/systemd/system/gunicorn.service

Place the following content (update the WorkingDirectory path depending on your installation)

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=pi
Group=pi
WorkingDirectory=/home/pi/radiogaga/back
ExecStart=gunicorn --bind 0.0.0.0:8000 radiogaga.wsgi:application

[Install]
WantedBy=multi-user.target

We can now start the Gunicorn service we created and enable it so that it starts at boot:

sudo systemctl daemon-reload
sudo systemctl start gunicorn
sudo systemctl enable gunicorn

The backend API should now be accessible on the port 8000 of the server.