Small Python web interface for raspistill to take photos with the RaspberryPi in the browser. I used the pyramid framework for site generation and bootstrap for fancy mobile-first layouts.
For a successful installation you need:
I'll provide a guide to install raspistillWeb based on the tutorial from the pyramid framework to install raspistillWeb in a seperate python environment, so that your systems python environment is not effected.
Make sure that your raspbian and your camera is working. Try to make a photo with raspistill to verify that your camera is working.
Install python3-dev (if not already on your system), setuptools and exif and virtualenv via pip:
sudo apt-get install python3-dev python3-pip python3-setuptools exif
sudo pip3 install virtualenv
Create a virtual environment for python (sudo not required and not recommended):
mkdir ~/Development
(Or another directory)cd ~/Development
virtualenv --python=python3 env
cd env
Install raspistillWeb
git clone https://github.com/TimJuni/raspistillWeb.git
cd raspistillWeb
../bin/python3 setup.py develop
(this may take some time)Initialize the database
../bin/initialize_raspistillweb_db development.ini
Run raspistillWeb
../bin/pserve development.ini
http://<adress of your pi>:6543
To update your Version of raspistillWeb, simply go into the raspistillWeb Directory and type:
git pull
../bin/python setup.py develop
Please notice, that you may need to install new dependencies (for example exif via apt-get)
If you run raspistillWeb over ssh, you cannot quit your ssh session, because the raspistillWeb process will be killed. One easy way to start raspistillWeb (and let it run even when you are logged off) is to use screen
:
sudo apt-get install screen
screen -S cam
../bin/pserve development.ini
At this point you can quit your ssh session and raspistillWeb will continue serving files. If you later want stop raspistillWeb, you can attach to the screen by: screen -r cam
If you want to use to raspistillWeb from the internet, you can set up an apache reverse proxy to restrict the access to the application. Therefore you have to open port 80 in your router for your pi and follow these instructions:
sudo apt-get install apache2
sudo a2enmod proxy_http
sudo a2dissite default
sudo nano /etc/apache2/sites-available/raspistillWeb
and add the following content:<VirtualHost *:80>
ServerName mydomain.org
<Location />
AuthType Basic
AuthName "raspistillWeb Login"
AuthUserFile /usr/local/passwd/passwords
Require user guest
</Location>
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://localhost:6543/
ProxyPassReverse / http://localhost:6543/
</VirtualHost>
Create a password file
sudo mkdir /usr/local/passwd
sudo htpasswd -c /usr/local/passwd/passwords guest
Enable the Virtualhost and restart the Webserver
sudo a2ensite raspistillWeb
sudo /etc/init.d/apache2 restart
When you surf http://<adress of your pi>
you should be asked for a username (guest) and a password (see step 5).
sudo nano /etc/init.d/raspistillweb
#!/bin/bash
cd /home/pi/Development/env/raspistillWeb
../bin/pserve development.ini
sudo chmod 755 /etc/init.d/raspistillweb
sudo update-rc.d /etc/init.d/raspistillweb defaults
This is my first project with python and pyramid. Feel free to leave a commend or a feature request.