'Python Flask - Resolution for H18 error on Heroku & Internal server error on AWS
I have a simple Flask application which has an export button. When the button is clicked, it will convert the data frame as CSV and return it as a response.
The app is working perfectly in local system. When deploying it in Heroku it is throwing H18 error.
The same app when deployed in AWS Ubuntu EC2 instance, it is throwing internal server error.
Can anyone please tell how to resolve this?
app = Flask(__name__)
@app.route("/", methods=["GET"])
@app.route("/home", methods=["GET"])
def home():
return render_template("index.html", flagSuccess=0)
@app.route("/export", methods=["POST"])
def export():
data = [["tom", 10], ["nick", 15], ["juli", 14]]
df = pd.DataFrame(data, columns=["Name", "Age"])
resp = make_response(df.to_csv())
resp.headers["Content-Disposition"] = "attachment; filename=export.csv"
resp.headers["Content-Type"] = "text/csv"
return resp
if __name__ == "__main__":
app.run()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
