Skip to content Skip to sidebar Skip to footer

Flask Not Displaying Http Address When I Run It

I'm trying to run the Hello World using Flask framework : from flask import Flask app = Flask(__name__) @app.route('/') def hello() -> str: return 'Hell world from Flask!'

Solution 1:

You are mixing old and new documentation. You can lose the last line in flaskhello.py (app.run()). Then, don't pass the flask run command to python, but run it directly in the CMD. So not python -m flask run, but flask run.


Solution 2:

I've tested your code and it is serving a page with Hell world from Flask!, are you sure your flask servers starts, do you see the following in the console:

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [04/Aug/2019 13:35:44] "GET / HTTP/1.1" 200 -

Starting with Flask 0.11 there are multiple built-in ways to run a development server. The best one is the flask command line utility (https://flask.palletsprojects.com/en/1.1.x/server/)

export FLASK_APP= flaskhello.py
flask run

enter image description here


Post a Comment for "Flask Not Displaying Http Address When I Run It"