redirectする - bottle
bottleでリダイレクトをする方法
/abc
にアクセスしたら、/def
にリダイレクトしたい
from bottle import route, run from bottle import redirect @route('/abc') def test1(): redirect('/def') @route('/def') def test2(): return 'defのページ' run(host='localhost', port=3000, debug=True, reloader=True)
redirect
をインポート- redirect(リダイレクト先のURL)でリダイレクトできる
/abc
にアクセスすると、/def
に飛ばされて、「defのページ」って表示された
/abc?name=fafie;afjiekafjdif;ejgnieaojfe
とかのときに使えるかな?