What is the reaction of the flask to using variables from an HTML form request and updating the csv file with them?

EDIT: I adjusted the title because it was marked as a duplicate. And although the error in the duplicate is the same, I need help to understand which Flask / HTML response is returned to update csv with my form variables.

I have a jar application that creates a dynamic graph and extracts it from a csv file.

I want to send new data to csv (and therefore to the chart) by entering through an HTML form. The fact is that this will allow you to update the schedule from a web page, and not edit the local CSV.

Here is a brief snippet of my HTML:

<h1>Input New Polls for Graph</h1> <form method="POST" action="/send"> <input type="text" placeholder="Date"> <input type="text" placeholder="0.2"> <input type = ... <input type="submit" name="Submit"> </form> 

This is what the corresponding part of my app.py flash file looks like:

 @app.route('/send', methods=['GET', 'POSTS']) def send(): if request.method == 'POST': Date = request.form['Date'] Num1 = request.form['Num1'] Numi = ... newInput = ['Date', 'Num1', 'Numi...'] with open(r'GraphData.csv', 'a') as f: writer = csv.writer(f) writer.writerow(newInput) 

In additional code, including the pandas package, the program currently accepts data from my local GraphData.csv file and it displays the graph correctly.

When I go to the local host address with 127 ../ send, I get:

'Error 500, the view function did not return a response .

I know this is probably a logical mistake, but I'm not sure if there is a more efficient or Putin way to accomplish what I'm trying to do here.

0
python flask forms csv
source share

No one has answered this question yet.

See similar questions:

nine
The Flask view raises a TypeError: the 'bool' object is not called

or similar:

774
Save PL / pgSQL output from PostgreSQL to CSV file
377
Returning a JSON response from the Checkbox view
360
HTML Input = "file" Accept attribute file type (CSV)
3
Python download file of the form: urllib2 ClientForm
one
Bad request (400) for a flask with a request for $ .ajax
one
The flask query does not return any information from the selected
0
Schoolboy mistake with jars?
0
How to use Python Flask to make a real-time reaction corresponding to a change in the web client (user input)?
0
Flask form gives 400 bad requests
-one
How to use html form and paste it into MySQL database (python-flask)

All Articles