Merge branch 'python+markdown' of https://github.com/0x01FE/My-Website into python+markdown

This commit is contained in:
0x01fe 2024-03-14 13:16:07 -05:00
commit 0798b5b37a
6 changed files with 20 additions and 8 deletions

3
.gitignore vendored
View File

@ -2,3 +2,6 @@ __pycache__
*.md *.md
!POST_TEMPLATE.md !POST_TEMPLATE.md
!README.md !README.md
docker-compose.yaml
*.sh

View File

@ -15,4 +15,4 @@ RUN python3 -m pip install -r requirements.txt
WORKDIR ./app WORKDIR ./app
CMD ["python3", "-u", "./app.py"] CMD ["python3", "-u", "app.py"]

View File

@ -3,6 +3,7 @@ import configparser
import random import random
import flask import flask
import waitress
import markdown import markdown
from post import Post from post import Post
@ -15,10 +16,12 @@ config.read(CONFIG_PATH)
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'])
DEV = int(config['NETWORK']['DEV'])
def get_posts(category_filter : str | None = None) -> list[Post]: def get_posts(category_filter : str | None = None) -> list[Post]:
post_files = glob.glob(f'{POSTS_FOLDER}/*') post_files = glob.glob(f'{POSTS_FOLDER}/*')
post_files.remove(f'{POSTS_FOLDER}\\POST_TEMPLATE.md') post_files.remove(f'{POSTS_FOLDER}/POST_TEMPLATE.md')
posts: list[Post] = [] posts: list[Post] = []
for post_file in post_files: for post_file in post_files:
@ -68,4 +71,7 @@ def index():
if __name__ == "__main__": if __name__ == "__main__":
app.run() if DEV:
app.run(port=PORT)
else:
waitress.serve(app, host='0.0.0.0', port=PORT)

View File

@ -25,7 +25,7 @@ What do you mean ... You can't see it?
I don't believe you, your eyes deceive you, better check yourself in I don't believe you, your eyes deceive you, better check yourself in
You will say I'm crazy, I will go on my way 'cause it's what I need You will say I'm crazy, I will go on my way 'cause it's what I need
I'd cross a thousand seas just to prove I'm not mad I'd cross a thousand seas just to prove I'm not mad
I thoguht I saw a statue blink, and a bird with no head, Land on a golden thread, I rub my eyes, What am I saying? There's nothing there I thought I saw a statue blink, and a bird with no head, Land on a golden thread, I rub my eyes, What am I saying? There's nothing there
Solar Sect of Mystic Wisdom Solar Sect of Mystic Wisdom
~ Nuclear Fusion ~ Nuclear Fusion
Check out [NEUPINK](https://neupink.bandcamp.com/album/swordflower-hills-killer-2)! Check out [NEUPINK](https://neupink.bandcamp.com/album/swordflower-hills-killer-2)!

View File

@ -1,8 +1,9 @@
[POSTS] [POSTS]
posts_folder=./posts posts_folder=posts
[STATUS] [STATUS]
status_file=./resources/status.text status_file=resources/status.text
[NETWORK] [NETWORK]
DEV=0
PORT=1111 PORT=1111

View File

@ -1,2 +1,4 @@
Markdown==3.5.2 Markdown==3.5.2
Flask==2.2.3 Flask==2.2.3
waitress==2.1.2
Werkzeug==2.2.3