From 1936f87b3654df5df7778e218001baa6585edaf2 Mon Sep 17 00:00:00 2001 From: Ignace Date: Mon, 24 Mar 2025 19:17:24 +0000 Subject: [PATCH] first --- README.md | 0 meteoo.py | 31 +++++++++++++++++++++++++++++++ meteoo.wsgi | 15 +++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 README.md create mode 100644 meteoo.py create mode 100644 meteoo.wsgi diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/meteoo.py b/meteoo.py new file mode 100644 index 0000000..c4ec56a --- /dev/null +++ b/meteoo.py @@ -0,0 +1,31 @@ +#!/usr/bin/python3 + +import sys +import os +import datetime +from rrdtool import update as rrd_update +from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, json, make_response +from werkzeug.exceptions import HTTPException + +# configuration +DEBUG = False +SECRET_KEY = 'Mdevelopment key' + +app = Flask(__name__) +app.config.from_object(__name__) + +@app.route('/', methods=['GET']) +def index(): + ''' + pick up data for rrd's + ''' + if request.method == 'GET': + if 'binnen' in request.args: + ret = rrd_update(os.path.join('/var/www/suy.nl/w/fromhue.rrd'), request.args['binnen']) + return "Ok", 200 + + +if __name__ == '__main__': + app.secret_key = 'a38738svnlsfnviureiue598y3498f34ifjoielknf 3o4ifj o3i4f o3i4ufho3i4iwe34' + app.run(host='0.0.0.0', port=8080) + diff --git a/meteoo.wsgi b/meteoo.wsgi new file mode 100644 index 0000000..05e4165 --- /dev/null +++ b/meteoo.wsgi @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +import sys +sys.path.insert(0, '/usr/share/projects/wsgi_apps/meteoo') + +from meteoo import app as application + +# to add this Flas, python3 application to apache, you need to install the following +# sudo apt-get install python3-flask +# sudo apt-get install python3-pip +# sudo pip3 install twython +# +# sudo mkdir /var/dashboard2015 +# sudo chown www-data /var/dashboard2015 +# sudo apt-get install libapache2-mod-wsgi-py3