diff --git a/kamera_server.py b/kamera_server.py new file mode 100644 index 0000000..f768b24 --- /dev/null +++ b/kamera_server.py @@ -0,0 +1,10 @@ +from flask import Flask +kamera_server = Flask(__name__) + +@kamera_server.route("/") +def first_function(): + return "

I am hosted on Raspberry Pi !!!

" + +if __name__ == "__main__": + kamera_server.run(host='0.0.0.0') + \ No newline at end of file diff --git a/raspi_setup.md b/raspi_setup.md index 356228d..9382fcc 100644 --- a/raspi_setup.md +++ b/raspi_setup.md @@ -57,4 +57,39 @@ source bin/activate Wenn alles geklappt hat, befindet man sich jetzt in der virtuellen Python Umgebung und kann dort die benötigten Module installieren ``` -pip install rpi.gpio \ No newline at end of file +pip install rpi.gpio flask uwsgi +deactivate +``` + +### streaming-kamera klonen + +``` +cd /opt/kamera +git clone https://git.jgz-energie.net/ENERGIE/streaming-kamera.git + +Außerhalb der virtuellen Umgebung kann das Programm mit `/opt/kamera/bin/python /opt/kamera/streaming-kamera/kamera.py gestartet` werden. + +Der uWSGI-Server kann mit `/opt/kamera/bin/uwsgi --socket 0.0.0.0:8000 --protocol=http -w server:first_app`, wenn man sich in dem Arbeitsverzeichnis (/opt/kamera/streaming-kamera) befindet. + +### Service für uWSGI anlegen + +/opt/kamera/uwsgi_config.ini + +``` +[uwsgi] + +chdir = /opt/kamera/streaming-kamera +module = kamera_server:server + +master = true +processes = 1 +threads = 2 + +uid = kamera +gid = kamera +socket = /tmp/sample_app.sock +chmod-socket = 664 +vacuum = true + +die-on-term = true +``` \ No newline at end of file diff --git a/server.py b/server.py deleted file mode 100644 index 7ca4bd3..0000000 --- a/server.py +++ /dev/null @@ -1,10 +0,0 @@ -from flask import Flask -first_app = Flask(__name__) - -@first_app.route("/") -def first_function(): - return "

I am hosted on Raspberry Pi !!!

" - -if __name__ == "__main__": - first_app.run(host='0.0.0.0') - \ No newline at end of file