Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is my Flask API returning none in the html

I am having issues understanding Flask API’s and what is needed to return the required information. I can print the data such as:

crunchbaseNY = crunchbase[crunchbase['city'] == 'New York']
print(crunchbaseNY)

but when put into Flask it is returned as ‘None’

from flask import Flask, render_template
app = Flask("MyApp")

@app.route('/')
def hello_world():
    output = print(crunchbaseNY)
    return render_template('index.html', result=output)
    #return output
    
app.run(host='localhost', port=5001)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You did

output = print(crunchbaseNY)

print do print and return None, please change it to

output = str(crunchbaseNY)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading