[Flask] Store Data in a SQLite-Database with Flask
coreybrett at gmail.com
Mon Nov 21 16:16:19 EST 2016
This is not related to Flask, but maybe you could use Zabbix Sender to send
your data to a Zabbix server for collection.
On Nov 21, 2016 4:10 PM, "Anthony Ford" <ford.anthonyj at gmail.com> wrote:
> I created a similar system to monitor a series of Modbus enabled GPIO
> units (Acromag
> <https://www.acromag.com/catalog/318/ethernet-modbus-profibus-io/ethernet-io-modules/multi-function-io/busworks-900en-series> units).
> Flask is not well suited to having a data logger within it.
> Flask is more of a User Interface, and is event based, meaning that
> nothing happens until the server (and therefore your Flask app) get a
> request from a browser. This means you can easily fetch the current state
> when someone wants it (i.e. a big "FETCH STATUS" button). However, if you
> need periodic monitoring (like I did), it is better to have a separate
> program that ONLY does the data logging.
> You can possibly get away with threading, and launching a separate thread
> from within your Flask app, but I personally think it's not worth the
> If you use a full database system (PostgreSQL is my go-to) instead of
> SQLite, it is easy to have the logger application dump into the database,
> while the Flask app reads from the Database.
> If you avoid using Flask-SQLAlchemy in favor of vanilla (or standard)
> SQLAlchemy, you can even share the database modules between the apps (via a
> common shared package, or just plain importing from one or the other).
> If desired, I can talk more about my approach, but unfortunately I can't
> share code, and sanitizing the code to be shareable would take a lot of
> Hope this helps!
> Anthony Ford,
> ford.anthonyj at gmail.com
> On Sun, Nov 20, 2016 at 1:23 PM, Dmitry <d at ddipp.net> wrote:
>> Hello Andreas!
>> Tell me - why do you need a flask?
>> Flask - web framework, and you have a function, framed by "@app.route" is
>> caused not through the web, and from the same program.
>> Try to remove the "@ app.route" to function.
>> Also, you will not be initialized "g.db". Think about why.
>> 20.11.2016 21:23, Andreas Dorfner пишет:
>> Hello everyone,
>> I'm new to python and flask web development.
>> I have to realize a data logger using flask. By using another framework
>> called 'pymodbus', I get some data from
>> an energy meter and save that data to a variable called 'crv_data' (see
>> file attached). This part is working so far!
>> The second part of the project contains the storage of 'crv_data' to a
>> SQLite-Database. For that, I'm using flask.
>> For creating a table with five columns, a file 'schema.sql' (also
>> attached) is included.
>> If the file 'logger.py' is running, a database is produced with the
>> desired layout and some data in 'crv_data' is available.
>> But there is no data included in the database.
>> I think there is an error in function 'add_entry()' (starting in line 72
>> of logger.py file), because if I call the function
>> in the infinite loop (line 103), the program stops running.
>> Maybe I have to say that I using Beaglebone Black with running Debian on
>> Does anybody have an idea, why the program doesn't work?
>> Many thanks,
>> Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
>> Flask mailing listFlask at python.orghttps://mail.python.org/mailman/listinfo/flask
>> Dmitry Podkovyrkin
>> email: d at ddipp.net
>> Flask mailing list
>> Flask at python.org
> Flask mailing list
> Flask at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Flask