Redirecting an old URL to a new one with Flask micro-framework
from flask import Flask, redirect, url_for
app = Flask(__name__)
@app.route('/old_url')
def old_url():
return redirect(url_for('new_url'))
@app.route('/new_url')
def new_url():
return 'This is the new URL'
if __name__ == '__main__':
app.run(debug=True)