added some stuff for running on my server
This commit is contained in:
parent
d22af9734e
commit
c172cafdbc
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,3 +2,6 @@ __pycache__
|
|||||||
*.md
|
*.md
|
||||||
!POST_TEMPLATE.md
|
!POST_TEMPLATE.md
|
||||||
!README.md
|
!README.md
|
||||||
|
|
||||||
|
docker-compose.yaml
|
||||||
|
*.sh
|
||||||
@ -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"]
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import configparser
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
|
import waitress
|
||||||
|
|
||||||
from post import Post
|
from post import Post
|
||||||
|
|
||||||
@ -14,10 +15,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:
|
||||||
@ -67,4 +70,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)
|
||||||
@ -25,4 +25,4 @@ 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
|
||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
Loading…
x
Reference in New Issue
Block a user