mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Moved unneeded ImproperlyConfigured inner imports.
This commit is contained in:
parent
1df89a60c5
commit
b5511dddd6
@ -3,12 +3,12 @@
|
||||
"""
|
||||
from django.contrib.gis.gdal import HAS_GDAL
|
||||
from django.contrib.gis.utils.wkt import precision_wkt # NOQA
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
if HAS_GDAL:
|
||||
from django.contrib.gis.utils.ogrinfo import ogrinfo # NOQA
|
||||
from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect # NOQA
|
||||
from django.contrib.gis.utils.srs import add_srs_entry # NOQA
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
try:
|
||||
# LayerMapping requires DJANGO_SETTINGS_MODULE to be set,
|
||||
# so this needs to be in try/except.
|
||||
|
@ -12,6 +12,7 @@ import sys
|
||||
import warnings
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db import utils
|
||||
from django.db.backends import utils as backend_utils
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
@ -24,7 +25,6 @@ from django.utils.safestring import SafeBytes, SafeText
|
||||
try:
|
||||
import MySQLdb as Database
|
||||
except ImportError as e:
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
raise ImproperlyConfigured(
|
||||
'Error loading MySQLdb module: %s.\n'
|
||||
'Did you install mysqlclient or MySQL-python?' % e
|
||||
@ -48,7 +48,6 @@ from .validation import DatabaseValidation # isort:skip
|
||||
version = Database.version_info
|
||||
if (version < (1, 2, 1) or (
|
||||
version[:3] == (1, 2, 1) and (len(version) < 5 or version[3] != 'final' or version[4] < 2))):
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
raise ImproperlyConfigured("MySQLdb-1.2.1p2 or newer is required; you have %s" % Database.__version__)
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@ import sys
|
||||
import warnings
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db import utils
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.utils import six, timezone
|
||||
@ -28,7 +29,6 @@ def _setup_environment(environ):
|
||||
try:
|
||||
import ctypes
|
||||
except ImportError as e:
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
raise ImproperlyConfigured("Error loading ctypes: %s; "
|
||||
"the Oracle backend requires ctypes to "
|
||||
"operate correctly under Cygwin." % e)
|
||||
@ -51,7 +51,6 @@ _setup_environment([
|
||||
try:
|
||||
import cx_Oracle as Database
|
||||
except ImportError as e:
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
|
||||
|
||||
# Some of these import cx_Oracle, so import them after checking if it's installed.
|
||||
|
@ -14,6 +14,7 @@ import warnings
|
||||
import pytz
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db import utils
|
||||
from django.db.backends import utils as backend_utils
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
@ -31,7 +32,6 @@ try:
|
||||
except ImportError:
|
||||
from sqlite3 import dbapi2 as Database
|
||||
except ImportError as exc:
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
|
||||
|
||||
# Some of these import sqlite3, so import them after checking if it's installed.
|
||||
@ -167,7 +167,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
def get_connection_params(self):
|
||||
settings_dict = self.settings_dict
|
||||
if not settings_dict['NAME']:
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
raise ImproperlyConfigured(
|
||||
"settings.DATABASES is improperly configured. "
|
||||
"Please supply the NAME value.")
|
||||
|
Loading…
Reference in New Issue
Block a user