app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World!'

@app.route('/myredirect')
def my_redirect():
    return redirect(url_for('hello_world', _anchor='my_anchor'))
if __name__ == '__main__':
    app.run()
Flask redirect url with anchor