Documentation
Table of Contents:
- Raspberry Pi Initial Setup
- Install Dependancies
- Compile OpenCV from Source
- Configure Web Server
- Setup Iris
Raspberry Pi Initial Setup
This guide assumes that you have already setup network and users
-
Update the Pi
sudo apt update -y && sudo apt upgrade -y
-
Configure the Pi
-
Run raspi-config
sudo raspi-config
-
Enable the camera module
go to Interfacing Options and enable the camera module. -
Expand the file system
go to Advanced options and Expand file system. -
Reboot
sudo reboot now
-
Run raspi-config
-
Update the firmware
sudo rpi-update
-
Reboot
sudo reboot now
Install Dependancies
-
Install screen
Screen is used for running multiple shells at once, this is required if you intend on running multiple components of Iris on the same machine.
sudo apt install screen -y
-
(Optional) Install bindfs
While not required, bindfs allows you to mount a directory and access it as if it was your own, this is especially useful for Nginx webroots for example.
sudo apt install bindfs -y
-
Install git
sudo apt install git -y
-
Install pip3
sudo apt install python-pip3 -y
Compile OpenCV
To compile OpenCV, please follow the instructions on the web page linked below:
Compile OpenCV on Raspberry Pi
Please note that you need to compile it for
Python 3 and not Python 2.
Configure Web Server
Nginx (Preferred)
-
Install Nginx
sudo apt install nginx -y
-
Add your own user to the www-data group
sudo usermod -a -G www-data dylan
-
Modify the default configuration file
sudo nano /etc/nginx/sites-available/default
using the Iris nginx configuration file as a guideline.
Don't forget to Make changes to the directories and URL as needed. -
(Optional) Setup Nginx error pages
Nginx is already configured to look for error pages in/var/www/iris/error/
, all you need to do is put the required files in there.
400.html | Error 400 - Bad Request
403.html | Error 403 - Permission Denied
404.html | Error 404 - Not Found
You may use the examples above or replace them with your own.
Apache
Coming Soon.
Setup Iris
-
Change to your home directory
cd ~
-
Clone the Iris repo from GitHub
git clone --recurse-submodules https://github.com/DylanGore/Iris.git "iris"
and cd into it
cd iris/
-
Setup Django
Change into the correct directory
cd src/web/
Install Python dependancies via pip
sudo pip3 install -r requirements.txt
-
Configure Django for a live environment
Edit the django settings file
nano irisPrime/settings.py
and modify the following settings:- Change
SECRET_KEY = 'PUT_SECRET_KEY_HERE'
- Generate a new secret key and replacePUT_SECRET_KEY_HERE
with it. - Change
DEBUG = True
toDEBUG = False
- Change
ALLOWED_HOSTS = []
toALLOWED_HOSTS = ['BASE_URL']
- Add
STATIC_ROOT = '/var/www/iris/static/'
underSTATIC_URL = '/static/'
(this is the web accessible directory where the static files go)
- Change
-
Collect the static files and move them to the
STATIC_ROOT
directory
python3 manage.py collectstatic
-
Create the database
python3 manage.py migrate --run-syncdb
-
Create a superuser
python3 manage.py createsuperuser
and follow the prompts to set the username, e-mail address and password. -
Run the server
python3 manage.py runserver