1

Hi i have a flask app with a react front end. Where the react htmls generated through npm build are rendered. I also want the react frontend to show these flash messages as per the conditions. But since the backend and frontend are not dynamically connected. What options do i have to resolve this issues ? Below i have sample code showing some of the conditions.

@user.route('/supervised', methods=['GET', 'POST'])
def supervised():
    form = SubmitData()
    if request.method == 'POST':
        if 'file' not in request.files:
            flash('No file part')
            return redirect(request.url)
        file = request.files['file']
        try:
            file2 = request.files['file2']
        except werkzeug.exceptions.BadRequestKeyError:
            file2 = None
        if file.filename == '':
            flash('No selected file')
            return redirect(request.url)
        if allowed_file(file.filename) is False:
            flash('Please upload a .csv file for training dataset.')
            return redirect(request.url)
        flash('Message')
                return render_template('support.html')
    return render_template('supervised.html', form=form)
Ali Mehdi
  • 11
  • 1

0 Answers0