diff --git a/.gitignore b/.gitignore index 2ed48ce..4028b36 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ __pycache__ *.md !POST_TEMPLATE.md !README.md + +docker-compose.yaml +*.sh \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 963ed85..6a5b9c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,4 @@ RUN python3 -m pip install -r requirements.txt WORKDIR ./app -CMD ["python3", "-u", "./app.py"] +CMD ["python3", "-u", "app.py"] diff --git a/app/website.py b/app/app.py similarity index 82% rename from app/website.py rename to app/app.py index e0976ba..9d2c99f 100644 --- a/app/website.py +++ b/app/app.py @@ -3,6 +3,7 @@ import configparser import random import flask +import waitress from post import Post @@ -14,10 +15,12 @@ config.read(CONFIG_PATH) POSTS_FOLDER = config['POSTS']['POSTS_FOLDER'] 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]: - post_files= glob.glob(f'{POSTS_FOLDER}/*') - post_files.remove(f'{POSTS_FOLDER}\\POST_TEMPLATE.md') + post_files = glob.glob(f'{POSTS_FOLDER}/*') + post_files.remove(f'{POSTS_FOLDER}/POST_TEMPLATE.md') posts: list[Post] = [] for post_file in post_files: @@ -67,4 +70,7 @@ def index(): if __name__ == "__main__": - app.run() + if DEV: + app.run(port=PORT) + else: + waitress.serve(app, host='0.0.0.0', port=PORT) diff --git a/app/resources/status.text b/app/resources/status.text index a00b8ec..af19294 100644 --- a/app/resources/status.text +++ b/app/resources/status.text @@ -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 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 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 \ No newline at end of file +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 \ No newline at end of file diff --git a/config.ini b/config.ini index 63cc0da..8bc9e69 100644 --- a/config.ini +++ b/config.ini @@ -1,8 +1,9 @@ [POSTS] -posts_folder=./posts +posts_folder=posts [STATUS] -status_file=./resources/status.text +status_file=resources/status.text [NETWORK] +DEV=0 PORT=1111 diff --git a/requirements.txt b/requirements.txt index 67443c6..1308c6c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ Markdown==3.5.2 -Flask==2.2.3 \ No newline at end of file +Flask==2.2.3 +waitress==2.1.2 +Werkzeug==2.2.3 \ No newline at end of file