From 7b7aa239fd262764408faae4c3aff09a10738241 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Wed, 17 Feb 2021 18:26:04 -0500 Subject: [PATCH] autocreate db cache table when needed and reenable WAL mode --- archivebox/config.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/archivebox/config.py b/archivebox/config.py index 07fe4a4b..edbafc0f 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -1080,16 +1080,16 @@ def setup_django(out_dir: Path=None, check_db=False, config: ConfigDict=CONFIG, django.setup() # Enable WAL mode in sqlite3 - # from django.db import connection - # with connection.cursor() as cursor: - # cursor.execute("PRAGMA journal_mode=wal;") + from django.db import connection + with connection.cursor() as cursor: + cursor.execute("PRAGMA journal_mode=wal;") - # Create cache table in DB - # try: - # from django.core.cache import cache - # cache.get('test', None) - # except django.db.utils.OperationalError: - # call_command("createcachetable", verbosity=0) + # Create cache table in DB if needed + try: + from django.core.cache import cache + cache.get('test', None) + except django.db.utils.OperationalError: + call_command("createcachetable", verbosity=0) from django.conf import settings