Nick Sweeting 5 anni fa
parent
commit
6ac48d7c35
2 ha cambiato i file con 3 aggiunte e 8 eliminazioni
  1. 1 5
      archivebox/index/sql.py
  2. 2 3
      archivebox/manage.py

+ 1 - 5
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:

+ 2 - 3
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)')