-1

I am a beginner to flask and I have been trying to run a simple program. For some reasons I am using THONNY as I just could not get flask running in a virtualenv even after so many tries. In thonny it worked without a virtualenv

Coming at the point I wrote a simple code

from flask import Flask

app = Flask(__name__)

@app.route('/')

def index():
    return 'Flask webapp'

if __name__ == "__main__":
    app.run(debug = True)

When I did not pass debug = True the app worked and was started on a localhost but after adding debug it gave me the following error

 * Serving Flask app 'app' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Restarting with stat
C:\Users\Workstation\AppData\Local\Programs\Thonny\python.exe: No module named thonny.plugins.cpython.app

What could be a possible fix to it? Should I continue using thonny for flask?

Rishi N
  • 57
  • 6

1 Answers1

1

Install Flask by running (pip3 if using Python 3 and using linux) pip install flask - in a terminal.

When you install flask, run your code in a terminal by typing (py if you are using windows) py filename.py

(python or python3 if you are using linux or mac) python filename.py