Reputation:
from flask import Flask
app = Flask(__main__)
if __name__ == "__main__":
app.run()
So this is my code and I don't think anything is wrong with it, I downloaded flask from pycharm and command prompt, but still doesnt work, could someone help?
The error:
[Errno 2] No such file or directory
Upvotes: 0
Views: 233
Reputation: 7656
First thing first, your first line is wrong. You wrote app = Flask(main) instead of app= Flask(name_).
Also I would Add at least a Hello world. So try with this and see if it works:
from flask import Flask
app = Flask(__name__)
if __name__ == "__main__":
app.run()
Is not really clear How you got this error. However because you are using Pycharm it may be because you have not configured the Pycharm's interpreter correctly?
Does this video solve your issue and can you confirm you have and interpreter? ---->
No python interpreter configured for the project pycharm
If this didn't solve your issue, then are you sure you are running the file correctly?
Alt+Shift+F10 and then select the script you want to run.
After that Shift+F10 will run the last script that has been run.
If also this didn't help then specify better your issue, add screenshot if needed. Also because if once you adjust the code still give you issue, is a Pycharm Configuration issue a not with the code itself
Upvotes: 1