Reputation: 39
I am new to using Flask. Tried to run the basic flask app but results in neither an error nor any output. Can anyone help me to resolve the same?
Code:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
if __name__ == '__main__':
app.run(debug=True, use_reloader=False)
console:
* Serving Flask app "__main__" (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
I'm not getting *Running on http://127.0.0.1:5000/ (press ctrl+c to quit)
.
Can anyone help me on this, please?
Upvotes: 1
Views: 857
Reputation: 81
app = Flask(__name__)
You forgot the underscores.
if __name__ == '__main__':
app.run()
Upvotes: 1
Reputation: 9
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, world!"
if __name__ == '__main__':
app.run(debug=True, use_reloader=False)
Please compare your own code with mine, there were some things you left out.
Upvotes: 0