diff --git a/archivebox/core/settings.py b/archivebox/core/settings.py index 923ae62c..3b2ad688 100644 --- a/archivebox/core/settings.py +++ b/archivebox/core/settings.py @@ -18,6 +18,7 @@ from ..config import ( CUSTOM_TEMPLATES_DIR, SQL_INDEX_FILENAME, OUTPUT_DIR, + ARCHIVE_DIR, LOGS_DIR, TIMEZONE, @@ -63,6 +64,7 @@ INSTALLED_APPS = [ 'core', 'api', + 'signal_webhooks', 'django_extensions', ] @@ -253,6 +255,23 @@ CACHES = { EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' +STORAGES = { + "archive": { + "BACKEND": "django.core.files.storage.FileSystemStorage", + "OPTIONS": { + "base_url": "/archive/", + "location": ARCHIVE_DIR, + }, + }, + # "personas": { + # "BACKEND": "django.core.files.storage.FileSystemStorage", + # "OPTIONS": { + # "base_url": "/personas/", + # "location": PERSONAS_DIR, + # }, + # }, +} + ################################################################################ ### Security Settings ################################################################################ @@ -379,3 +398,15 @@ LOGGING = { } }, } + + +# Add default webhook configuration to the User model +SIGNAL_WEBHOOKS = { + "HOOKS": { + "django.contrib.auth.models.User": ..., + "core.models.Snapshot": "...", + "core.models.ArchiveResult": "...", + "core.models.Tag": "...", + "api.models.APIToken": "...", + }, +} diff --git a/archivebox/index/schema.py b/archivebox/index/schema.py index 0a9b39c5..8aa4e1c3 100644 --- a/archivebox/index/schema.py +++ b/archivebox/index/schema.py @@ -4,6 +4,7 @@ WARNING: THIS FILE IS ALL LEGACY CODE TO BE REMOVED. DO NOT ADD ANY NEW FEATURES TO THIS FILE, NEW CODE GOES HERE: core/models.py +These are the old types we used to use before ArchiveBox v0.4 (before we switched to Django). """ __package__ = 'archivebox.index' diff --git a/archivebox/main.py b/archivebox/main.py index 1f3324d2..6f745c0b 100755 --- a/archivebox/main.py +++ b/archivebox/main.py @@ -230,7 +230,7 @@ def version(quiet: bool=False, p = platform.uname() print( 'ArchiveBox v{}'.format(get_version(CONFIG)), - *((f'COMMIT_HASH={COMMIT_HASH[:7]}',) if COMMIT_HASH else ()), + f'COMMIT_HASH={COMMIT_HASH[:7] if COMMIT_HASH else 'unknown'}', f'BUILD_TIME={BUILD_TIME}', ) print( @@ -1356,7 +1356,7 @@ def manage(args: Optional[List[str]]=None, out_dir: Path=OUTPUT_DIR) -> None: if (args and "createsuperuser" in args) and (IN_DOCKER and not IS_TTY): stderr('[!] Warning: you need to pass -it to use interactive commands in docker', color='lightyellow') stderr(' docker run -it archivebox manage {}'.format(' '.join(args or ['...'])), color='lightyellow') - stderr() + stderr('') execute_from_command_line([f'{ARCHIVEBOX_BINARY} manage', *(args or ['help'])]) diff --git a/archivebox/manage.py b/archivebox/manage.py index 1a9b2975..413a4cfb 100755 --- a/archivebox/manage.py +++ b/archivebox/manage.py @@ -7,7 +7,7 @@ if __name__ == '__main__': # versions of ./manage.py commands whenever possible. When that's not possible # (e.g. makemigrations), you can comment out this check temporarily - if not ('makemigrations' in sys.argv or 'migrate' in sys.argv): + if not ('makemigrations' in sys.argv or 'migrate' in sys.argv or 'startapp' in sys.argv): print("[X] Don't run ./manage.py directly (unless you are a developer running makemigrations):") print() print(' Hint: Use these archivebox CLI commands instead of the ./manage.py equivalents:') diff --git a/pyproject.toml b/pyproject.toml index 2c8b3fe2..8f009769 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,7 @@ dependencies = [ # - gallery-dl # - scihubdl # - See Github issues for more... + "django-signal-webhooks>=0.3.0", ] homepage = "https://github.com/ArchiveBox/ArchiveBox"