Python/flask: Difference between revisions

From Wiki
No edit summary
No edit summary
Line 26: Line 26:
log.setLevel(logging.ERROR)
log.setLevel(logging.ERROR)
</pre>
</pre>
== Links ==
* https://github.com/tko22/flask-boilerplate

Revision as of 19:57, 28 April 2019

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>'


Disable flask log

import logging
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)


Links