Re: [flask] Stream console output to Website
- From:
- Andy D'Arcy Jewell
- Date:
- 2014-08-22 @ 20:40
I wrote a very simple sort of shared clipboard server in flask which
does something similar to what you want: the browser polls the server
frequently, via a bit of javascript which gets the current status from a
special url, and then refreshes the page if there has been one:
http://flask.pocoo.org/docs/0.10/patterns/streaming/
You might find it useful.
On 22/08/14 12:38, Dorian Hoxha wrote:
> There are 2 ways:
>
> 1. A javascript function polls the backend for progress
> 2. You make a websocket/server-sent-events connection, so you can
> stream to the frontend data
>
> Or maybe this:
>
> http://flask.pocoo.org/docs/0.10/patterns/streaming/
>
>
> On Fri, Aug 22, 2014 at 1:32 PM, Dennis Scheiba <Dennis.Scheiba@gmx.de
> <mailto:Dennis.Scheiba@gmx.de>> wrote:
>
> Hi,
>
> I wrote a little script that takes some time to execute, but shows
> it’s progress in the console. Well, I need to use this script in
> Flask and I’m trying to get the console output streamed to the
> website. I searched and I have readt a bit trough the web, but I
> couldn’t find a simple explanation how to do this.
>
> Here is what I have already written:
>
> https://gist.github.com/capital-G/30522605bce079f99eeb#file-webfrontend-py
>
> So rry if it is a simple question, it is my first object
> orientated python script and I’m new to programming.
>
> Thanks in advance
>
> Dennis
>
>