mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
move sqlite3 checks up a level
This commit is contained in:
parent
0c7d7deb32
commit
d0f129295f
1 changed files with 5 additions and 6 deletions
|
@ -1203,12 +1203,6 @@ def setup_django(out_dir: Path=None, check_db=False, config: ConfigDict=CONFIG,
|
||||||
except django.db.utils.OperationalError:
|
except django.db.utils.OperationalError:
|
||||||
call_command("createcachetable", verbosity=0)
|
call_command("createcachetable", verbosity=0)
|
||||||
|
|
||||||
|
|
||||||
with connection.cursor() as cursor:
|
|
||||||
config['SQLITE_VERSION'] = cursor.execute("SELECT sqlite_version();").fetchone()[0]
|
|
||||||
config['SQLITE_JOURNAL_MODE'] = cursor.execute('PRAGMA journal_mode;').fetchone()[0]
|
|
||||||
config['SQLITE_EXTENSIONS'] = ['JSON1'] if ('ENABLE_JSON1',) in cursor.execute('PRAGMA compile_options;').fetchall() else []
|
|
||||||
|
|
||||||
# if archivebox gets imported multiple times, we have to close
|
# if archivebox gets imported multiple times, we have to close
|
||||||
# the sqlite3 whenever we init from scratch to avoid multiple threads
|
# the sqlite3 whenever we init from scratch to avoid multiple threads
|
||||||
# sharing the same connection by accident
|
# sharing the same connection by accident
|
||||||
|
@ -1220,5 +1214,10 @@ def setup_django(out_dir: Path=None, check_db=False, config: ConfigDict=CONFIG,
|
||||||
assert sql_index_path.exists(), (
|
assert sql_index_path.exists(), (
|
||||||
f'No database file {SQL_INDEX_FILENAME} found in: {config["OUTPUT_DIR"]} (Are you in an ArchiveBox collection directory?)')
|
f'No database file {SQL_INDEX_FILENAME} found in: {config["OUTPUT_DIR"]} (Are you in an ArchiveBox collection directory?)')
|
||||||
|
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
config['SQLITE_VERSION'] = cursor.execute("SELECT sqlite_version();").fetchone()[0]
|
||||||
|
config['SQLITE_JOURNAL_MODE'] = cursor.execute('PRAGMA journal_mode;').fetchone()[0]
|
||||||
|
config['SQLITE_EXTENSIONS'] = ['JSON1'] if ('ENABLE_JSON1',) in cursor.execute('PRAGMA compile_options;').fetchall() else []
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise SystemExit(2)
|
raise SystemExit(2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue