diff --git a/src/app.py b/src/app.py index 924d3eb..d72c7c1 100644 --- a/src/app.py +++ b/src/app.py @@ -1,8 +1,7 @@ from flask import Flask +from routes.index import router as index +from routes.read import router as read -app = Flask(__name__) - - -@app.route("/") -def hello_world(): - return "
Hello, World!
" +app = Flask(__name__, static_url_path="/", static_folder="public") +app.register_blueprint(index, url_prefix="/") +app.register_blueprint(read, url_prefix="/read") diff --git a/src/public/css/style.css b/src/public/css/style.css new file mode 100644 index 0000000..f0437fa --- /dev/null +++ b/src/public/css/style.css @@ -0,0 +1,3 @@ +html { + font-family: "Courier New", Courier, monospace; +} diff --git a/src/routes/index.py b/src/routes/index.py new file mode 100644 index 0000000..694a71f --- /dev/null +++ b/src/routes/index.py @@ -0,0 +1,13 @@ +""" +Index page with a list of posts. +""" + +from flask import Blueprint, render_template + +router = Blueprint("index", __name__) + + +@router.route("") +def index() -> str: + """Index page""" + return render_template("index.html") diff --git a/src/routes/read.py b/src/routes/read.py new file mode 100644 index 0000000..2303b6a --- /dev/null +++ b/src/routes/read.py @@ -0,0 +1,13 @@ +""" +Read a specific post. +""" + +from flask import Blueprint, render_template + +router = Blueprint("read", __name__) + + +@router.route("") +def read() -> str: + """Read page""" + return render_template("read.html") diff --git a/src/templates/head.html b/src/templates/head.html new file mode 100644 index 0000000..6cf4630 --- /dev/null +++ b/src/templates/head.html @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/templates/header.html b/src/templates/header.html new file mode 100644 index 0000000..f3a8152 --- /dev/null +++ b/src/templates/header.html @@ -0,0 +1 @@ +Welcome to the index page
+ + + + + {% include "post.html" %} + + diff --git a/src/templates/post.html b/src/templates/post.html new file mode 100644 index 0000000..dc1c977 --- /dev/null +++ b/src/templates/post.html @@ -0,0 +1 @@ + diff --git a/src/templates/read.html b/src/templates/read.html new file mode 100644 index 0000000..b145366 --- /dev/null +++ b/src/templates/read.html @@ -0,0 +1,17 @@ + + + + {% include "head.html" %} +Welcome to the read page
+ + + + + + + +