Running simple flask - getting 404 - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Running simple flask - getting 404 (/thread-22028.html) |
Running simple flask - getting 404 - beginner1 - Oct-25-2019 Hi, Have a file called hello.py saved to D: drive as below. from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello, World!"Have ran pip install -U Flask from D:\python using conda prompt. D:\Python is area we have python installed to says successful. In conda windows prompt have typed set FLASK_APP=hello flask run says Running on http://127.0.0.1:5000 When type http://127.0.0.1:5000 into chrome or browser gives 404 and doensn't launch browser automtically. also tried running python flask run but still not getting output. Ultimately looking to possibly use flask as way of deploying machine learning models and looking to see if can get hello world app running as starter for ten. Anyone know what missing and how can achieve this? Thanks Found another site and tried from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run()saved as hello.py and ran python D:\hello.py went to website and looks to work RE: Running simple flask - getting 404 - Larz60+ - Oct-25-2019 use: from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run() RE: Running simple flask - getting 404 - beginner1 - Oct-28-2019 Thanks for update |