Basic Flask Program Returning 500 Server Error
Trying to setup a basic flask (Python) app in PyCharm Below is the basic 'Hello world' app modified with some Python I already know. I changed the return 'Hello world!' to return c
Solution 1:
You must return something Flask recognizes as a response from a view. This includes render_template
, jsonify
, or a custom Response
object. In your case it looks like you want to return a JSON object, so use jsonify
.
Solution 2:
You are returning a dictionary; Flask requires you to return a string, a response object or a valid WSGI application. See the response rules.
You could either return a string version of the dictionary, hand the dictionary to a template, or return a JSON response. You didn't state what you expected to be returned, however.
If you just want to see your contacts 'on a blank page', convert the dictionary to a string:
return str(contacts)
Post a Comment for "Basic Flask Program Returning 500 Server Error"