Home > Back-end >  Flask not Running
Flask not Running

Time:12-17

When trying to run my hello.py file it says it can't be imported, was working previously but just stopped, can't work out why

[Below is an imagine of my code and what i entered into the terminal]

CodePudding user response:

From your image I see your app is under try directory, but in terminal you are in home probably. You need to cd into try or export relative path, like export FLASK_APP=try.hello

CodePudding user response:

Add the code below in your code. It will work. And make sure the terminal is the current directory. (Specify the host and the port based on what ports are open) or just use 127.0.0.1

if __name__ == "__main__":
app.run(debug=True, host="192.168.68.91", port=5000)
  • Related