8000 Django: Call django.setup always if available · alex-python/celery@94b455f · GitHub
[go: up one dir, main page]

Skip to content

Commit 94b455f

Browse files
committed
Django: Call django.setup always if available
1 parent 3aaff58 commit 94b455f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

celery/fixups/django.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,16 @@ def __init__(self, app):
134134
)
135135

136136
def validate_models(self):
137+
import django
138+
try:
139+
django.setup()
140+
except AttributeError:
141+
pass
137142
s = io.StringIO()
138143
try:
139144
from django.core.management.validation import get_validation_errors
140145
except ImportError:
141-
import django
142146
from django.core.management.base import BaseCommand
143-
django.setup()
144147
cmd = BaseCommand()
145148
cmd.stdout, cmd.stderr = sys.stdout, sys.stderr
146149
cmd.check()

0 commit comments

Comments
 (0)
0