The Flask Flash option to display the success message is throwing the below error when the code is deployed in the EC2 ubuntu platform, while its working fine in the local host.
I used the below link for the reference.
https://pythonise.com/series/learning-flask/flask-message-flashing
The error displayed is typeerror: flash() takes 0 positional arguments but 1 was given
Main.py
from flask import flash
@app.route("/index", methods=["GET", "POST"])
def index():
flash(“success data is uploaded”)
return render_template("flash.html")
flash.html
{% extends "user.html" %}
{% block content %}
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<div class="alert alert-primary alert-dismissible fade show"
role="alert">
<span>{{ message }}</span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
{% endblock content %}
Error Message:
flash() takes 0 positional arguments but 1 was given