diff options
author | 2018-04-16 19:50:57 +0200 | |
---|---|---|
committer | 2018-04-16 19:50:57 +0200 | |
commit | 6d752731dfd9b4b9fa983f6c6c6e02047641f92e (patch) | |
tree | 37de08d0f0fdf4a90901d5f5c4fe7bde7253dfe9 | |
parent | Fixed the weird navbar sizing (diff) |
Adding some trace logging to the table init to figure out what's going wrong.
Diffstat (limited to '')
-rw-r--r-- | pysite/database.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pysite/database.py b/pysite/database.py index 3ecdf53b..2603f125 100644 --- a/pysite/database.py +++ b/pysite/database.py @@ -78,13 +78,19 @@ class RethinkDB: :return: """ + self.log.debug("Initializing tables") initialized = {} for table, primary_key in ALL_TABLES.items(): + self.log.trace(f"Checking if {table} is empty.") + # If the table is empty if not self.pluck(table, primary_key): + self.log.trace(f"{table} appears to be empty. Checking if there is a json file at {os.getcwd()}" + f"pysite/database/table_init/{table}.json") + # And a corresponding JSON file exists if os.path.isfile(f"pysite/database/table_init/{table}.json"): @@ -92,6 +98,9 @@ class RethinkDB: with open(f"pysite/database/table_init/{table}.json") as json_file: table_data = json.load(json_file) + self.log.trace(f"Loading the json file into the table. " + f"The json file contains {len(table_data)} rows.") + for row in table_data: self.insert( table, |