0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Flask で Hello World

Last updated at Posted at 2023-08-15

プログラム

hello.py
from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
	str_out = '<h2>こんにちは!</h2>'
	str_out += '<p>Aug/15/2023</p>'
	return str_out

app.run(host='0.0.0.0')

実行

python hello.py

実行した時の様子

$ python hello.py
 * Serving Flask app 'hello'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:5000
 * Running on http://192.168.1.6:5000
Press CTRL+C to quit

クライアントでアクセス

http://127.0.0.1:5000/

image.png

確認したバージョン

$ flask --version
Python 3.12.3
Flask 3.0.2
Werkzeug 3.0.1
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?