Python/flask: Difference between revisions

From Wiki
(Die Seite wurde neu angelegt: „== redirect ==“)
 
No edit summary
Line 1: Line 1:
== redirect ==
== redirect ==
<blockquote>
<pre>
@app.route('/')
def hello():
    return redirect("http://www.example.com", code=302)
</pre>
</blockquote>
<blockquote>
<pre>
@app.route('/')
def root():
    def get():
        yield "Getting data..."
        dostuff()
        yield '<script>document.location.href="http://192.168.111.11:5000/list"</script>'
</pre>
</blockquote>

Revision as of 09:42, 25 October 2017

redirect

@app.route('/')
def hello():
    return redirect("http://www.example.com", code=302)
@app.route('/')
def root():
    def get():
        yield "Getting data..."
        dostuff()
        yield '<script>document.location.href="http://192.168.111.11:5000/list"</script>'