[This repo has been discontinued; streaming on our printers is instead done through OctoPrint, which is set up through the octopi-setup
repo]
Stream from Raspberry Pi to Django website with WebSockets.
- Enter the home folder if you are not already there:
cd /home/pi/
- Clone this repository:
git clone https://github.com/MAKENTNU/stream.git
- Enter the newly created
stream
folder:cd stream/
The rest of the steps can be completed by running the setup script ./setup.sh
.
It will ask for the stream name, which can only consist of english letters, numbers, hyphens or underscores.
The secret can be found on locally on the MAKE NTNU server in local_settings.py
and is called stream_key
.
The RPi will reboot once the script is done and the stream should now be visible on the website.
The STREAM_NAME
and KEY
can be edited manually if needed:
- Enter stream folder
cd stream
- Edit file
nano local_settings.py
reboot
The steps that the script does, is described below.
- Create a virtual environment
sudo virtualenv -p python3 env_stream
- Source environment
source env_stream/bin/activate
- Install system libraries
sudo apt install libopenjp2-7 libtiff5 libjpeg-dev python3-dev
- Install requirements
pip install -r requirements.txt
- Deactivate environment
deactivate
- Copy service to systemd
sudo cp stream.service /etc/systemd/system/stream.service
- Enable service
sudo systemctl enable stream
- Start service
sudo systemctl start stream
Detailed guide of the hardware setup is available on MAKE NTNU's Google Drive.