From 11ef9cabfba7ae5178fa5922669c59e5fa62020e Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Fri, 25 Oct 2024 22:06:01 +0200 Subject: [PATCH] Add config.py --- src/app.py | 9 +-------- src/config.py | 8 ++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 src/config.py diff --git a/src/app.py b/src/app.py index 12372e9..931f74f 100644 --- a/src/app.py +++ b/src/app.py @@ -1,16 +1,9 @@ -import os - -from dotenv import load_dotenv from flask import Flask, render_template from api import api +from config import API_HOST, DATABASE_URI from db import get_endpoints_from_db, init_db -load_dotenv() - -DATABASE_URI = os.getenv("DATABASE") -API_HOST = os.getenv("API_HOST") - app = Flask(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = DATABASE_URI app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False diff --git a/src/config.py b/src/config.py new file mode 100644 index 0000000..8e48550 --- /dev/null +++ b/src/config.py @@ -0,0 +1,8 @@ +import os + +from dotenv import load_dotenv + +load_dotenv() + +DATABASE_URI = os.getenv("DATABASE") +API_HOST = os.getenv("API_HOST")