Advice regarding Real-Time applications

41 views
Skip to first unread message

Daniel Correa

unread,
Mar 17, 2020, 11:43:03 AM3/17/20
to web2py-users
Hello community,

I know I might be losing some concepts but I'm new in web2py and web development in general.
I'll try to explain my problem to you,
I have a csv file which is getting updated every second, but I don't know how to fetch this data to web2py, I mean, the file is in the static folder, but then I have two options to graph the values:

One of them is getting the file with JavaScript but this appereantly doesn't work when the site is on production (from another device).
The other one is somehow fetching the data from the csv file to the database of web2py, but then I have doubts if this data is actually getting fetched in real-time and updating the database in the production site, or how is this happening?

So far I think the best option is creating a database which is getting updated by...( a model?) and then just calling the values in the views.

Does anyone has any idea how this could be done in an efficient way?

Thanks in advance.


Dave S

unread,
Mar 17, 2020, 5:09:49 PM3/17/20
to web2py-users

I recommend you use a scheduler task.
<URL:http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler>
 See also
<URL:http://web2py.com/books/default/chapter/29/13/deployment-recipes#Start-the-scheduler-as-a-Linux-service-upstart->
and
<URL:http://web2py.com/books/default/chapter/29/13/deployment-recipes#Initial-Queuing-of-a-Repeating-Task>

You can also use an external scheduler, although that hasn't been much discussed in the web2py environment.  It is the standard approach in the next-gen framework (py4web), where celery is the recommended approach to scheduling.

Your task should run periodically, check for a new copy of the CSV, and import it into the appropriate database using standard DAL tools.
<URL:http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Exporting-and-importing-data>

Good luck!

/dps



Reply all
Reply to author
Forward
0 new messages