Skip to content

Commit d52ba1b

Browse files
authored
Merge pull request #218 from an7oine/healthcheck
Compatibility with single-module Django apps
2 parents c26a2f4 + 387e3be commit d52ba1b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

django_ai_assistant/apps.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,10 @@ def ready(self):
1717
import_module(f"{app.name}.ai_assistants")
1818
except ModuleNotFoundError:
1919
# If the module exists but there is an error in it, we want to raise the error:
20-
if importlib.util.find_spec(f"{app.name}.ai_assistants"):
21-
raise
20+
try:
21+
# This raises on single-module app, e.g. django-health-check v4.0+:
22+
# health_check.contrib.celery.
23+
if importlib.util.find_spec(f"{app.name}.ai_assistants"):
24+
raise
25+
except ModuleNotFoundError:
26+
pass

0 commit comments

Comments
 (0)