Skip to content

Little python web interface for raspistill to take photos with the RaspberryPi

License

Notifications You must be signed in to change notification settings

Athemis/phytopi

Repository files navigation

raspistillWeb

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.

alt text

Requirements

For a successful installation you need:

  • a RaspberryPi with raspbian installed (other os not tested, but should work too)
  • a RaspberryPi Camera Kit

Installation Notes

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.

  1. Make sure that your raspbian and your camera is working. Try to make a photo with raspistill to verify that your camera is working.

  2. Install python2.7-dev (if not already on your system), virtualenv, setuptools and exif:

  • sudo apt-get install python2.7-dev python-virtualenv python-setuptools exif
  1. Create a virtual environment for python (sudo not required and not recommended):
  • mkdir ~/Development (Or another directory)
  • cd ~/Development
  • virtualenv --no-site-packages env
  • cd env
  1. Install raspistillWeb
  • git clone https://github.com/TimJuni/raspistillWeb.git
  • cd raspistillWeb
  • ../bin/python setup.py develop
  1. Run raspistillWeb
  • ../bin/pserve development.ini
  • surf http://<adress of your pi>:6543

Updates

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)

Example Configurations

Running raspistillWeb over ssh

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:

  1. Install screen
  • sudo apt-get install screen
  1. Create a new screen
  • screen -S cam
  1. Start raspistillWeb
  • ../bin/pserve development.ini
  1. Detatch the screen
  • simply hit ctrl + a + d

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

Running raspistillWeb behind a Reverse Proxy (with Authentification)

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:

  1. Install Apache Web Server
    • sudo apt-get install apache2
  2. Enable Apache Proxy Mod
    • sudo a2enmod proxy_http
  3. Disable Default Site
    • sudo a2dissite default
  4. Create a new Virtualhost
    • 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>
  1. Create a password file

    • sudo mkdir /usr/local/passwd
    • sudo htpasswd -c /usr/local/passwd/passwords guest
    • Enter a password
  2. 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).

Run raspistillWeb on startup

TODO

Future Work

This is my first project with python and pyramid. Feel free to leave a commend or a feature request.

About

Little python web interface for raspistill to take photos with the RaspberryPi

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 78.3%
  • Python 12.2%
  • Mako 9.5%