Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29425

Flask Flash message not working in AWS EC2 Ubuntu machine

$
0
0

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">&times;</span>
            </button>
        </div>
    {% endfor %}
{% endif %}
{% endwith %}

{% endblock content %}

Error Message:

flash() takes 0 positional arguments but 1 was given


Viewing all articles
Browse latest Browse all 29425

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>