When redirecting within a blueprint, you need to include the blueprint's name in the call to url_for
.
If working with a blueprint defined like
notes_app = Blueprint('notes_app', __name__, template_folder='templates')
you would need to use
@notes_app.route('/search', methods=['POST'])
@login_required
def search():
query = request.form.get('query')
return redirect(url_for('notes_app.search_results', query=query)