made a template for the writing page
This commit is contained in:
parent
a66265e813
commit
6c2f7427f7
28
app/app.py
28
app/app.py
@ -1,6 +1,8 @@
|
|||||||
|
import os
|
||||||
import glob
|
import glob
|
||||||
import configparser
|
import configparser
|
||||||
import random
|
import random
|
||||||
|
import datetime
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import flask
|
import flask
|
||||||
@ -15,6 +17,7 @@ CONFIG_PATH = "./config.ini"
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(CONFIG_PATH)
|
config.read(CONFIG_PATH)
|
||||||
|
|
||||||
|
WRITING_FOLDER = 'static/writing/'
|
||||||
POSTS_FOLDER = config['POSTS']['POSTS_FOLDER']
|
POSTS_FOLDER = config['POSTS']['POSTS_FOLDER']
|
||||||
STATUS_FILE = config['STATUS']['STATUS_FILE']
|
STATUS_FILE = config['STATUS']['STATUS_FILE']
|
||||||
PORT = int(config['NETWORK']['PORT'])
|
PORT = int(config['NETWORK']['PORT'])
|
||||||
@ -161,6 +164,31 @@ def programming():
|
|||||||
|
|
||||||
return flask.render_template('programming.html', posts=post_bodies, status=status)
|
return flask.render_template('programming.html', posts=post_bodies, status=status)
|
||||||
|
|
||||||
|
@app.route('/writing/')
|
||||||
|
def writing():
|
||||||
|
|
||||||
|
works = []
|
||||||
|
|
||||||
|
# Get all works in writing folder
|
||||||
|
files = glob.glob(WRITING_FOLDER + '*')
|
||||||
|
|
||||||
|
for path in files:
|
||||||
|
|
||||||
|
date: str = datetime.datetime.fromtimestamp(os.path.getctime(path)).strftime("%B %d, %Y")
|
||||||
|
name: str = path.split('/')[-1]
|
||||||
|
|
||||||
|
works.append({
|
||||||
|
'date' : date,
|
||||||
|
'name' : name,
|
||||||
|
'path' : path
|
||||||
|
})
|
||||||
|
|
||||||
|
return flask.render_template('writing.html', works=works)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# About Page
|
# About Page
|
||||||
@app.route('/about/')
|
@app.route('/about/')
|
||||||
def about():
|
def about():
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<body>
|
|
||||||
<a href="/">home</a>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<a href="/writing/scream.txt">Scream</a> March 27th, 2024
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -18,6 +18,7 @@
|
|||||||
<a href="../music/">Music</a><br>
|
<a href="../music/">Music</a><br>
|
||||||
<a href="../motion-pictures/">Motion Picture</a><br>
|
<a href="../motion-pictures/">Motion Picture</a><br>
|
||||||
<a href="../programming/">Programming</a><br>
|
<a href="../programming/">Programming</a><br>
|
||||||
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="."><u>About</u></a>
|
<a href="."><u>About</u></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
<a href="../music/">Music</a><br>
|
<a href="../music/">Music</a><br>
|
||||||
<a href="../motion-pictures/">Motion Picture</a><br>
|
<a href="../motion-pictures/">Motion Picture</a><br>
|
||||||
<a href="../programming/">Programming</a><br>
|
<a href="../programming/">Programming</a><br>
|
||||||
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="../about/">About</a>
|
<a href="../about/">About</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
<a href="/music/">Music</a><br>
|
<a href="/music/">Music</a><br>
|
||||||
<a href="/motion-pictures/">Motion Picture</a><br>
|
<a href="/motion-pictures/">Motion Picture</a><br>
|
||||||
<a href="/programming/">Programming</a><br>
|
<a href="/programming/">Programming</a><br>
|
||||||
<a href="/writing.html">Writing</a><br>
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="/about/">About</a>
|
<a href="/about/">About</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
<a href="../music/">Music</a><br>
|
<a href="../music/">Music</a><br>
|
||||||
<a href="."><u>Motion Picture</u></a><br>
|
<a href="."><u>Motion Picture</u></a><br>
|
||||||
<a href="../programming/">Programming</a><br>
|
<a href="../programming/">Programming</a><br>
|
||||||
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="../about/">About</a>
|
<a href="../about/">About</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
<a href="."><u>Music</u></a><br>
|
<a href="."><u>Music</u></a><br>
|
||||||
<a href="../motion-pictures/">Motion Picture</a><br>
|
<a href="../motion-pictures/">Motion Picture</a><br>
|
||||||
<a href="../programming/">Programming</a><br>
|
<a href="../programming/">Programming</a><br>
|
||||||
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="../about/">About</a>
|
<a href="../about/">About</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
<a href="../music/">Music</a><br>
|
<a href="../music/">Music</a><br>
|
||||||
<a href="../motion-pictures/">Motion Picture</a><br>
|
<a href="../motion-pictures/">Motion Picture</a><br>
|
||||||
<a href="."><u>Programming</u></a><br>
|
<a href="."><u>Programming</u></a><br>
|
||||||
|
<a href="/writing/">Writing</a><br>
|
||||||
<a href="../about/">About</a>
|
<a href="../about/">About</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
11
app/templates/writing.html
Normal file
11
app/templates/writing.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<body>
|
||||||
|
<a href="/">home</a>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
{% for work in works %}
|
||||||
|
<a href="/{{ work.path }}">{{ work.name }}</a> {{ work.date }}
|
||||||
|
{% endfor %}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user