From 62e45befa2683703493374be077061e3ed11044b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 22 Dec 2023 05:10:20 +0100 Subject: [PATCH] fix: docker python path and data creation --- Dockerfile | 8 +++++++- src/app.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 473683e..4aaf033 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ FROM python:3.11.6-alpine3.18 RUN addgroup -S td && adduser -S td -G td WORKDIR /txtdiary +RUN mkdir ./data && chown td:td ./data COPY LICENSE . @@ -15,4 +16,9 @@ COPY ./src ./app USER td -CMD [ "uwsgi", "--http", "0.0.0.0:80", "-Mw" ,"app.app", "--callable", "app" ] + +CMD [ "uwsgi", \ + "--http", "0.0.0.0:80", "-M", \ + "-w", "app", \ + "--callable", "app", \ + "--pythonpath", "/txtdiary/app" ] diff --git a/src/app.py b/src/app.py index aae2da6..bac78ba 100644 --- a/src/app.py +++ b/src/app.py @@ -7,7 +7,7 @@ from utils.config import Config app = Flask(__name__, static_url_path="/") # import all routes -for file in glob("src/routes/*.py"): +for file in glob("*/routes/*.py"): module = file.replace("/", ".").split(".")[-2] exec(f"from routes.{module} import router as {module}") exec(f"app.register_blueprint({module})")