From fa2235c4b97a9d3f30b79a5f77e3c4e79e022387 Mon Sep 17 00:00:00 2001 From: Eshaan Bansal Date: Sun, 12 Jul 2020 23:42:42 +0530 Subject: [PATCH] FLASK_APP not set correctly fix --- .github/INSTALLATION.md | 3 ++- app.json | 2 +- runtime.txt | 2 +- src/docker-entrypoint.sh | 1 + src/init_db.sh | 1 - 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/INSTALLATION.md b/.github/INSTALLATION.md index 525b5bd..6cd16d2 100644 --- a/.github/INSTALLATION.md +++ b/.github/INSTALLATION.md @@ -25,7 +25,8 @@ $ cd src/ 3. With `virtual environment` activated, install requirements, init db, ```bash -[venv]$ pip install -r requirements.txt +[venv]$ pip install -r requirements.txt +[venv]$ export FLASK_APP="FlaskRTBCTF:create_app()" [venv]$ chmod +x init_db.sh && ./init_db.sh # Only required on first run ``` diff --git a/app.json b/app.json index 1c9e822..9394b92 100644 --- a/app.json +++ b/app.json @@ -33,6 +33,6 @@ } }, "scripts": { - "postdeploy": "bash src/init_db.sh" + "postdeploy": "cd /app/src && export FLASK_APP='FlaskRTBCTF:create_app()' && sh init_db.sh" } } diff --git a/runtime.txt b/runtime.txt index f8624ef..f24fc1b 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.8.2 \ No newline at end of file +python-3.8.3 \ No newline at end of file diff --git a/src/docker-entrypoint.sh b/src/docker-entrypoint.sh index 77a4ba1..9012f0d 100644 --- a/src/docker-entrypoint.sh +++ b/src/docker-entrypoint.sh @@ -1,6 +1,7 @@ #!/bin/sh chmod +x init_db.sh runserver.sh +export FLASK_APP="FlaskRTBCTF:create_app()" # init/ migrate DB ./init_db.sh # run gunicorn production server diff --git a/src/init_db.sh b/src/init_db.sh index 77c7035..9c88e00 100644 --- a/src/init_db.sh +++ b/src/init_db.sh @@ -1,6 +1,5 @@ #!/bin/sh -export FLASK_APP="FlaskRTBCTF:create_app()" flask db init flask db migrate flask db upgrade