@user.route('/<user_id>', defaults={'username': None}) @user.route('/<user_id>/<username>') def show(user_id, username): pass