From 2de7f2fea15866711702b54165af1c8ac78e5951 Mon Sep 17 00:00:00 2001 From: Oto Imrich Date: Tue, 26 Sep 2023 18:11:40 +0200 Subject: [PATCH] init --- .gitignore | 3 +++ README.md | 0 app/__init__.py | 0 app/config.py | 15 +++++++++++++++ config_base.cfg | 2 ++ flaskapp.py | 0 requirements.txt | 0 scraper.py | 0 8 files changed, 20 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 app/__init__.py create mode 100644 app/config.py create mode 100644 config_base.cfg create mode 100644 flaskapp.py create mode 100644 requirements.txt create mode 100644 scraper.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2602141 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.venv +.idea +.config.cfg \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/config.py b/app/config.py new file mode 100644 index 0000000..1974439 --- /dev/null +++ b/app/config.py @@ -0,0 +1,15 @@ +import configparser +from os import path + +# parse base config file +config = configparser.ConfigParser() +config_path = path.dirname(path.abspath(__file__)) +config.read(path.join(config_path, "../config_base.cfg")) + +# check if custom configuration file exists and eventually load it +if path.exists((cfg_pth := path.join(config_path, "../config.cfg"))): + config.read(cfg_pth) + +settings = { + "mongodb_url": config.get("DB","MONGODB_URL") +} \ No newline at end of file diff --git a/config_base.cfg b/config_base.cfg new file mode 100644 index 0000000..21daf43 --- /dev/null +++ b/config_base.cfg @@ -0,0 +1,2 @@ +[DB] +MONGODB_URL = "mongodb://localhost:27017" \ No newline at end of file diff --git a/flaskapp.py b/flaskapp.py new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/scraper.py b/scraper.py new file mode 100644 index 0000000..e69de29