init
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.venv
|
||||||
|
.idea
|
||||||
|
.config.cfg
|
||||||
0
app/__init__.py
Normal file
0
app/__init__.py
Normal file
15
app/config.py
Normal file
15
app/config.py
Normal file
@@ -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")
|
||||||
|
}
|
||||||
2
config_base.cfg
Normal file
2
config_base.cfg
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[DB]
|
||||||
|
MONGODB_URL = "mongodb://localhost:27017"
|
||||||
0
flaskapp.py
Normal file
0
flaskapp.py
Normal file
0
requirements.txt
Normal file
0
requirements.txt
Normal file
0
scraper.py
Normal file
0
scraper.py
Normal file
Reference in New Issue
Block a user