from bottle import route, run, debug, error, request, template
@route('/home')
@route('/home/')
def login():
return template('templates/login')
@route('/home', method='POST')
@route('/home/', method='POST')
def welocme():
data = request.POST
if data:
password = data.get('password')
check_pass = 'password'
if password == check_pass:
return template('templates/welcome')
else:
return template('templates/login')
else:
return template('templates/login')
私の要件は次のとおりです。同じ URL でログイン ページとウェルカム ページを取得します。ログイン ページにはパスワード フィールドが 1 つしかありません。
私の問題:ログインして更新時にウェルカムページに再度アクセスすると、ログインページに移動します。ただし、理想的には、ウェルカム ページのみに表示する必要があります。
@error(404)
def error404(error):
return 'http://google.com'
私の 2 番目の問題: 404 の特定の URL にリダイレクトしたい.