From e97d779cd32844442372748b488e4740ac0df354 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 13 May 2024 02:35:19 -0700 Subject: [PATCH] move monkey patches to dedicated file --- archivebox/__init__.py | 5 +---- archivebox/api/apps.py | 4 ++++ archivebox/monkey_patches.py | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 archivebox/monkey_patches.py diff --git a/archivebox/__init__.py b/archivebox/__init__.py index 52f40d83..0924fd32 100755 --- a/archivebox/__init__.py +++ b/archivebox/__init__.py @@ -1,7 +1,4 @@ __package__ = 'archivebox' -# monkey patch django timezone to add back utc (it was removed in Django 5.0) -import datetime -from django.utils import timezone -timezone.utc = datetime.timezone.utc +from .monkey_patches import * diff --git a/archivebox/api/apps.py b/archivebox/api/apps.py index e64d943a..d7b8b0d9 100644 --- a/archivebox/api/apps.py +++ b/archivebox/api/apps.py @@ -3,5 +3,9 @@ __package__ = 'archivebox.api' from django.apps import AppConfig + class APIConfig(AppConfig): name = 'api' + + def ready(self): + pass diff --git a/archivebox/monkey_patches.py b/archivebox/monkey_patches.py new file mode 100644 index 00000000..0dcfa082 --- /dev/null +++ b/archivebox/monkey_patches.py @@ -0,0 +1,16 @@ +__package__ = 'archivebox' + +import django_stubs_ext + +django_stubs_ext.monkeypatch() + + +# monkey patch django timezone to add back utc (it was removed in Django 5.0) +import datetime +from django.utils import timezone +timezone.utc = datetime.timezone.utc + + +# monkey patch django-signals-webhooks to change how it shows up in Admin UI +# from signal_webhooks.apps import DjangoSignalWebhooksConfig +# DjangoSignalWebhooksConfig.verbose_name = 'API'