I am trying a simple Flask tutorial I found on-line. Here is the code:
from flask import Flask, jsonify from flask_cors import CORS # configuration DEBUG = True # instantiate the app app = Flask(__name__) app.config.from_object(__name__) # enable CORS CORS(app) # sanity check route @app.route('/ping', methods=['GET']) def ping_pong(): return jsonify('pong!') if __name__ == '__main__': app.run()
Spyder if I run the File, it works fine. However, I would like to be able to debug and execute statements as I select them. When I select the entire contents and execute (via the interactive console), I get the error below. Is there a way to make this work?
Serving Flask app "__main__" (lazy loading) Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead. Debug mode: on Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) Restarting with stat /opt/local/anaconda3/bin/python: can't find '__main__' module in '' An exception has occurred, use %tb to see the full traceback.