draft: some ideas on the project structure
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
This commit is contained in:
parent
1ea98eae5b
commit
76f77fdadd
9 changed files with 83 additions and 6 deletions
11
src/app.py
11
src/app.py
|
@ -1,8 +1,7 @@
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
from routes.index import router as index
|
||||||
|
from routes.read import router as read
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__, static_url_path="/", static_folder="public")
|
||||||
|
app.register_blueprint(index, url_prefix="/")
|
||||||
|
app.register_blueprint(read, url_prefix="/read")
|
||||||
@app.route("/")
|
|
||||||
def hello_world():
|
|
||||||
return "<p>Hello, World!</p>"
|
|
||||||
|
|
3
src/public/css/style.css
Normal file
3
src/public/css/style.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
html {
|
||||||
|
font-family: "Courier New", Courier, monospace;
|
||||||
|
}
|
13
src/routes/index.py
Normal file
13
src/routes/index.py
Normal file
|
@ -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")
|
13
src/routes/read.py
Normal file
13
src/routes/read.py
Normal file
|
@ -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")
|
12
src/templates/head.html
Normal file
12
src/templates/head.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<meta name="title" content="txtdiary" />
|
||||||
|
|
||||||
|
<meta property="og:title" content="txtdiary" />
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
|
||||||
|
<meta property="twitter:title" content="txtdiary" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/css/style.css" />
|
1
src/templates/header.html
Normal file
1
src/templates/header.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<header></header>
|
18
src/templates/index.html
Normal file
18
src/templates/index.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
{% include "head.html" %}
|
||||||
|
<title>Index</title>
|
||||||
|
</head>
|
||||||
|
<!-- TODO: icon of login in -->
|
||||||
|
{% include "header.html" %}
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<p>Welcome to the index page</p>
|
||||||
|
|
||||||
|
<!-- TODO: list of clickable posts -->
|
||||||
|
|
||||||
|
<!-- TODO: side block for posting something new when connected -->
|
||||||
|
{% include "post.html" %}
|
||||||
|
</body>
|
||||||
|
</html>
|
1
src/templates/post.html
Normal file
1
src/templates/post.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<span></span>
|
17
src/templates/read.html
Normal file
17
src/templates/read.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
{% include "head.html" %}
|
||||||
|
<title>Read</title>
|
||||||
|
</head>
|
||||||
|
{% include "header.html" %}
|
||||||
|
<body>
|
||||||
|
<p>Welcome to the read page</p>
|
||||||
|
|
||||||
|
<!-- TODO: show a specific post -->
|
||||||
|
|
||||||
|
<!-- TODO: button to edit the post if logged -->
|
||||||
|
|
||||||
|
<!-- TODO: button to delete the post if logged -->
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue