jazzband / django-redshift-backend

Redshift database backend for Django
Apache License 2.0
83 stars 47 forks source link

Compatibility with Django 1.11 #17

Closed duffn closed 7 years ago

duffn commented 7 years ago

When running Django 1.11, Python 3.5.3 and django-redshift-backend 0.6, this exception is thrown:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f3f8ce6c840>
Traceback (most recent call last):
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/db/utils.py", line 115, in load_backend
    return import_module('%s.base' % backend_name)
  File "/usr/local/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django_redshift_backend/base.py", line 14, in <module>
    from django.db.backends.postgresql_psycopg2.base import (
ImportError: cannot import name 'BaseDatabaseValidation'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/utils/autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
    self.check(display_num_errors=True)
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/core/checks/model_checks.py", line 30, in check_all_models
    errors.extend(model.check(**kwargs))
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/db/models/base.py", line 1282, in check
    errors.extend(cls._check_fields(**kwargs))
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/db/models/base.py", line 1357, in _check_fields
    errors.extend(field.check(**kwargs))
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 1137, in check
    errors = super(DateTimeCheckMixin, self).check(**kwargs)
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 219, in check
    errors.extend(self._check_backend_specific_checks(**kwargs))
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 322, in _check_backend_specific_checks
    return connections[db].validation.check_field(self, **kwargs)
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/db/utils.py", line 211, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/virtualenvs/dwtools/lib/python3.5/site-packages/django/db/utils.py", line 134, in load_backend
    raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'django_redshift_backend' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
    'mysql', 'oracle', 'postgresql', 'sqlite3'
Error was: cannot import name 'BaseDatabaseValidation'

Here is the import that causes the exception: https://github.com/shimizukawa/django-redshift-backend/blob/eb91b6452721160bdc8d9c4be76916f66a4788a7/django_redshift_backend/base.py#L22

The identical setup works with Django 1.10.5.

shimizukawa commented 7 years ago

Fixed by #19. Thanks!

dkarchmer commented 7 years ago

Could you release 0.7 as soon as possible so we can upgrade to Django 1.11? Thanks

shimizukawa commented 7 years ago

yeah, ASAP.

shimizukawa commented 7 years ago

Finally I make a release: https://pypi.python.org/pypi/django-redshift-backend/0.7