解決したいこと
チュートリアルを再現したい
ブラウザ上に’hallo world!'と表示したい
環境
windows 10 64bit
python 3.65
問題点
下記コードを入力し、同じ端末内のブラウザ(chlome)で該当ページが開けないです
python
1# test.py 2app = Flask(__name__) 3 4@app.route("/") 5def index(): 6 return "Hello World!" 7 8if __name__ == "__main__": 9 app.run()
上記をコマンドラインで実行しました
以下、コマンドライン上の表示です
* Serving Flask app "test" (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: off * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
上記状態でchromeで http://127.0.0.1:5000/ を開いてみる(アドレスバーにコピペ)
以下、ブラウザ上の表示です
Not Found The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
上記状態でchromeで http://localhost:5000/ を開いてみる(アドレスバーにコピペ)
以下、ブラウザ上の表示です
Not Found The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
試したこと
- ホストファイルを変更
https://ah-2.com/2010/06/27/windows_hosts_localhost.html
こちらのページを参考にコメントアウトされていたホストファイルを変更しました
- ポート状態の確認
コマンドライン(cmd)にて netstat -ano コマンドを実行
以下、実行結果(一部)です
TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 28356 TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 36752 TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 13588 TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 23924 TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 2460 TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 9880 TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 10744 TCP 127.0.0.1:5000 0.0.0.0:0 LISTENING 25988
ご指導よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。