We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0cd21c6 commit 00c596fCopy full SHA for 00c596f
django_prometheus/apps.py
@@ -1,5 +1,6 @@
1
from django.apps import AppConfig
2
from django.conf import settings
3
+import sys
4
5
import django_prometheus
6
from django_prometheus.exports import SetupPrometheusExportsFromConfig
@@ -19,6 +20,10 @@ def ready(self):
19
20
which shouldn't be done for real monitoring (since these jobs
21
are usually short-lived), but can be useful for debugging.
22
"""
23
+ if "manage.py" in sys.argv[0] or "django-admin" in sys.argv:
24
+ # Avoid exports when running management commands
25
+ return
26
+
27
SetupPrometheusExportsFromConfig()
28
if getattr(settings, "PROMETHEUS_EXPORT_MIGRATIONS", False):
29
ExportMigrations()
0 commit comments