From e8093971a40d6ae1f212c93f6840ebd83e95c088 Mon Sep 17 00:00:00 2001 From: Sashank Date: Sun, 9 Oct 2022 22:29:52 +0530 Subject: [PATCH] chore: remove env variable dependency for DB URI config --- README.md | 2 -- config.py | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 510b356..77563c2 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ git clone pip install -r requirements.txt ``` -Add `DATABASE_URL = sqlite:///local.db` in your environment variables. - Go to project root folder and execute `python3 main.py`. Go to `https://localhost:5000/ to see the site diff --git a/config.py b/config.py index 8d094b7..d671a19 100644 --- a/config.py +++ b/config.py @@ -1,4 +1,7 @@ import os + +basedir = os.path.abspath(os.path.dirname(__file__)) + class DevelopmentConfig: SQLALCHEMY_TRACK_MODIFICATIONS = False - SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') \ No newline at end of file + SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'local.db') \ No newline at end of file