use app_home env variable

This commit is contained in:
deflax 2023-11-17 21:07:16 -05:00
parent 2e2bd3da61
commit ee74acad1d
5 changed files with 11 additions and 10 deletions

View file

@ -1,6 +1,3 @@
FLASK_ENV=production
FLASK_APP=forest/__init__.py
APP_FOLDER=/home/app/web
SECRET_KEY=123
RECAPTCHA_PUBLIC_KEY=456
RECAPTCHA_PRIVATE_KEY=789

View file

@ -12,8 +12,8 @@ services:
- internal
pgadmin:
image: dpage/pgadmin4
volumes:
- "./data/dbadmin/pgadmin:/var/lib/pgadmin"
#volumes:
# - "./data/pgadmin/lib:/var/lib/pgadmin"
env_file:
- ./.env
ports:
@ -30,6 +30,10 @@ services:
command: gunicorn --bind 0.0.0.0:5000 manage:app
ports:
- 5000:5000
environment:
- "FLASK_ENV=production"
- "FLASK_APP=forest/__init__.py"
- "APP_HOME=/app"
env_file:
- ./.env
networks:

View file

@ -24,7 +24,8 @@ COPY . /usr/src/app/
# install python dependencies
COPY ./requirements.txt .
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
RUN --mount=type=cache,target=/root/.cache \
pip install --wheel-dir /usr/src/app/wheels -r requirements.txt
#########
@ -41,8 +42,7 @@ RUN mkdir -p /home/app
RUN addgroup --system app && adduser --system --group app
# create the appropriate directories
ENV HOME=/home/app
ENV APP_HOME=/home/app/web
ENV APP_HOME=/app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME

View file

@ -10,8 +10,8 @@ class Config(object):
RECAPTCHA_PRIVATE_KEY = f"{os.getenv('RECAPTCHA_PRIVATE_KEY')}"
SQLALCHEMY_DATABASE_URI = os.getenv("DATABASE_URL", "sqlite://")
SQLALCHEMY_TRACK_MODIFICATIONS = False
STATIC_FOLDER = f"{os.getenv('APP_FOLDER')}/forest/static"
MEDIA_FOLDER = f"{os.getenv('APP_FOLDER')}/forest/media"
STATIC_FOLDER = f"{os.getenv('APP_HOME')}/forest/static"
MEDIA_FOLDER = f"{os.getenv('APP_HOME')}/forest/media"
ADMIN_PREFIX = "fadmin"
MAIL_SERVER = f"{os.getenv('MAIL_SERVER')}"
MAIL_USERNAME = f"{os.getenv('MAIL_USERNAME')}"