GithubHelp home page GithubHelp logo

xujunjiejack / raspistillweb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phenotiki/raspistillweb

0.0 2.0 0.0 2.81 MB

Web-based interface to configure the Phenotiki device (Raspberry Pi for plant phenotyping)

Home Page: http://www.phenotiki.com/

License: GNU General Public License v3.0

Shell 0.12% Python 53.65% JavaScript 0.71% Mako 45.52%

raspistillweb's Introduction

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

Important notice: this version of raspistillWeb is a fork of the original project by Tim Jungnickel ([email protected]). This fork was created and is maintained by Massimo Minervini ([email protected]) with the purpose of adding features relevant to the Phenotiki project (http://phenotiki.com) for plant phenotyping applications.

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 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
  1. 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
  1. Install raspistillWeb
  • git clone https://github.com/TimJuni/raspistillWeb.git
  • cd raspistillWeb
  • ../bin/python3 setup.py develop (this may take some time)
  1. Initialize the database
  • ../bin/initialize_raspistillweb_db development.ini
  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

  1. Create a startup script
  • sudo nano /etc/init.d/raspistillweb
#!/bin/bash
cd /home/pi/Development/env/raspistillWeb
../bin/pserve development.ini
  1. Make the script executable sudo chmod 755 /etc/init.d/raspistillweb
  2. Register the script to be run at startup sudo update-rc.d /etc/init.d/raspistillweb defaults

Future Work

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

raspistillweb's People

Contributors

timjuni avatar

Watchers

James Cloos avatar Junjie Xu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.