@app.route('/')
def index():
    if request.url.startswith('http://'):
        return redirect(request.url.replace('http', 'https', 1).replace(
            '080', '443', 1))
Https with Http in Flask Python