Fixed #25941 -- Improved error message for runtests.py when django is not on path.

This commit is contained in:
Thomas Allison 2019-04-13 12:54:03 +02:00 committed by Mariusz Felisiak
parent e6d57c4d65
commit 3e8b733390
No known key found for this signature in database
GPG Key ID: 2EF56372BA48CD1B
1 changed files with 18 additions and 12 deletions

View File

@ -10,7 +10,13 @@ import sys
import tempfile
import warnings
try:
import django
except ImportError as e:
raise RuntimeError(
'Django module not found, reference tests/README.rst for instructions.'
) from e
else:
from django.apps import apps
from django.conf import settings
from django.db import connection, connections