mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
fix error log location
This commit is contained in:
parent
26fa63749d
commit
fb8e6cabcb
2 changed files with 11 additions and 8 deletions
|
@ -33,6 +33,7 @@ import django
|
|||
|
||||
from hashlib import md5
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
from typing import Optional, Type, Tuple, Dict, Union, List
|
||||
from subprocess import run, PIPE, DEVNULL
|
||||
from configparser import ConfigParser
|
||||
|
@ -1063,6 +1064,7 @@ def setup_django(out_dir: Path=None, check_db=False, config: ConfigDict=CONFIG,
|
|||
|
||||
try:
|
||||
import django
|
||||
|
||||
sys.path.append(str(config['PACKAGE_DIR']))
|
||||
os.environ.setdefault('OUTPUT_DIR', str(output_dir))
|
||||
assert (config['PACKAGE_DIR'] / 'core' / 'settings.py').exists(), 'settings.py was not found at archivebox/core/settings.py'
|
||||
|
@ -1082,6 +1084,14 @@ def setup_django(out_dir: Path=None, check_db=False, config: ConfigDict=CONFIG,
|
|||
with connection.cursor() as cursor:
|
||||
cursor.execute("PRAGMA journal_mode=wal;")
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
# log startup message to the error log
|
||||
with open(settings.ERROR_LOG, "a+") as f:
|
||||
command = ' '.join(sys.argv)
|
||||
ts = datetime.now().strftime('%Y-%m-%d__%H:%M:%S')
|
||||
f.write(f"\n> {command}; ts={ts} version={VERSION} docker={IN_DOCKER} is_tty={IS_TTY}\n")
|
||||
|
||||
if check_db:
|
||||
sql_index_path = Path(output_dir) / SQL_INDEX_FILENAME
|
||||
assert sql_index_path.exists(), (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue