I'm new to using flask, I tried to execute a basic flask app in Visual-Studio-code . but I'm getting,
No Module named app
My code is:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "Hello, World"
if __name__ == "__main__":
app.run(debug=True)
path :
The output terminal:
PS C:\Users\Rakesh\Desktop\The project copy> c:; cd 'c:\Users\Rakesh\Desktop\The project copy'; & 'C:\Python39\python.exe' 'c:\Users\Rakesh\.vscode\extensions\ms-python.python-2021.5.926500501\pythonFiles\lib\python\debugpy\launcher' '52116' '--' 'c:\Users\Rakesh\Desktop\The project copy\env\app.py'
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
No module named app
The path of app.py was inside the virtual environment , thus it is not working. Moving it out of that folder woks.