diff options
author | Joe Robinson <joe@lc8n.com> | 2021-11-25 03:25:44 +0000 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2021-11-25 03:25:44 +0000 |
commit | 439022f058cb2b9bbf6e2b46c067f4c828a1cab0 (patch) | |
tree | e1f40f477d3bb3597f52250541326885f9dbfdf8 /base.py |
Initial commit
Diffstat (limited to 'base.py')
-rw-r--r-- | base.py | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -0,0 +1,23 @@ +from peewee import MySQLDatabase, Model +import yaml + + +with open("config.yaml", "r") as yamlfile: + config = yaml.load(yamlfile, Loader=yaml.CLoader) + print("Read config successful") + config = config + + +db_conf = config["database"] +db = MySQLDatabase( + db_conf["name"], + user=db_conf["username"], + password=db_conf["password"], + host=db_conf["host"], +) +db.connect() + + +class BaseModel(Model): + class Meta: + database = db |