hanabiapp.views.index
1from flask import Blueprint, redirect, url_for 2from flask_login import current_user 3 4bp = Blueprint('index', __name__) 5 6@bp.route('/') 7def index(): 8 """ 9 ルートページ(`/`)へのアクセスを処理する関数. 10 11 - ユーザーがログイン済みの場合はホームページへリダイレクトする. 12 - 未ログインの場合はログインページへリダイレクトする. 13 14 Returns: 15 Response: ホームページまたはログインページへのリダイレクト 16 """ 17 if current_user.is_authenticated: 18 return redirect(url_for('home.home')) 19 return redirect(url_for('auth.login'))
bp =
<Blueprint 'index'>
@bp.route('/')
def
index():
7@bp.route('/') 8def index(): 9 """ 10 ルートページ(`/`)へのアクセスを処理する関数. 11 12 - ユーザーがログイン済みの場合はホームページへリダイレクトする. 13 - 未ログインの場合はログインページへリダイレクトする. 14 15 Returns: 16 Response: ホームページまたはログインページへのリダイレクト 17 """ 18 if current_user.is_authenticated: 19 return redirect(url_for('home.home')) 20 return redirect(url_for('auth.login'))
ルートページ(/
)へのアクセスを処理する関数.
- ユーザーがログイン済みの場合はホームページへリダイレクトする.
- 未ログインの場合はログインページへリダイレクトする.
Returns:
Response: ホームページまたはログインページへのリダイレクト