2
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?

More than 5 years have passed since last update.

目標

ブラウザに"Hello, world!"と表示するだけ。
fisrst-flask.png

環境

  • Windows 10 Pro
  • Python 3.7.5
  • flask 1.1.1

ディレクトリ構成

これだけ。
tree.png

ソースコード

index.htmlはVSCode上でEmmetで!と打ってtabで展開したものに<h1>Hello, world!</h1>を書いただけ。

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <h1>Hello, world!</h1>
</body>
</html>

sample.pyport='5555'としてるのに特に理由はない。

from flask import Flask, render_template

# インスタンス化
app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html');

if __name__ == '__main__':
    app.run(host='0.0.0.0', port='5555', debug=True)

起動

>python sample.py
2
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
2
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?