1
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 1 year has passed since last update.

python Flask

1
Last updated at Posted at 2023-06-08

ファイル構造

ProjectFile/
 ├ main.py/
 ├ templates/
  └ css/
    └ style.css/

Pythonファイル

import flask
from flask import render_template

app = flask.Flask(__name__,
                  static_folder='./templates/css')


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

if __name__ == '__main__':
    app.run(debug=True)

HTMLファイル

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel='stylesheet' href='css/style.css'>
</head>
<body>
<h1>Hello World</h1>

</body>
</html>

CSSファイル

body {
    background-color: antiquewhite;
}

h1 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Times New Roman', Times, serif;
}

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