made a template for the writing page

This commit is contained in:
0x01FE committed 2024-04-23 11:11:54 -05:00
1 parent a66265e813
commit 6c2f7427f7
9 files changed
+45 -10

No files matched your search

+28
View File
@@ -1,6 +1,8 @@
import os
import glob
import configparser
import random
import datetime
import requests
import flask
@@ -15,6 +17,7 @@ CONFIG_PATH = "./config.ini"
config = configparser.ConfigParser()
config.read(CONFIG_PATH)
WRITING_FOLDER = 'static/writing/'
POSTS_FOLDER = config['POSTS']['POSTS_FOLDER']
STATUS_FILE = config['STATUS']['STATUS_FILE']
PORT = int(config['NETWORK']['PORT'])
@@ -161,6 +164,31 @@ def programming():
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
@app.route('/about/')
def about():