From 6ac48d7c35f02cbe1c5f9277b8574d8b86947aff Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 6 Dec 2020 02:11:36 +0200 Subject: [PATCH] tweak warning msg --- archivebox/index/sql.py | 6 +----- archivebox/manage.py | 5 ++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/archivebox/index/sql.py b/archivebox/index/sql.py index 42d29b66..1e99f67c 100644 --- a/archivebox/index/sql.py +++ b/archivebox/index/sql.py @@ -4,6 +4,7 @@ from io import StringIO from pathlib import Path from typing import List, Tuple, Iterator from django.db.models import QuerySet +from django.db import transaction from .schema import Link from ..util import enforce_types @@ -23,8 +24,6 @@ def parse_sql_main_index(out_dir: Path=OUTPUT_DIR) -> Iterator[Link]: @enforce_types def remove_from_sql_main_index(snapshots: QuerySet, out_dir: Path=OUTPUT_DIR) -> None: - from django.db import transaction - with transaction.atomic(): snapshots.delete() @@ -49,8 +48,6 @@ def write_link_to_sql_index(link: Link): @enforce_types def write_sql_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR) -> None: - from django.db import transaction - with transaction.atomic(): for link in links: write_link_to_sql_index(link) @@ -59,7 +56,6 @@ def write_sql_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR) -> None: @enforce_types def write_sql_link_details(link: Link, out_dir: Path=OUTPUT_DIR) -> None: from core.models import Snapshot - from django.db import transaction with transaction.atomic(): try: diff --git a/archivebox/manage.py b/archivebox/manage.py index 6951d8f7..1a9b2975 100755 --- a/archivebox/manage.py +++ b/archivebox/manage.py @@ -8,10 +8,9 @@ if __name__ == '__main__': # (e.g. makemigrations), you can comment out this check temporarily if not ('makemigrations' in sys.argv or 'migrate' in sys.argv): - print("[X] Don't run ./manage.py directly, use the archivebox CLI instead e.g.:") - print(' archivebox manage createsuperuser') + print("[X] Don't run ./manage.py directly (unless you are a developer running makemigrations):") print() - print(' Hint: Use these archivebox commands instead of the ./manage.py equivalents:') + print(' Hint: Use these archivebox CLI commands instead of the ./manage.py equivalents:') print(' archivebox init (migrates the databse to latest version)') print(' archivebox server (runs the Django web server)') print(' archivebox shell (opens an iPython Django shell with all models imported)')