jonasundderwolf / django-image-cropping

Django helper application to easily and non-destructively crop arbitrarily large images in admin and frontend.
Other
553 stars 131 forks source link

Doesn't work with django 1.9b1. #80

Closed Dharmik8478 closed 8 years ago

Dharmik8478 commented 8 years ago

I am updating my project to 1.9b1 and while updating i am facing this error

File "/opt/pyvirtual/py_3.4-dj_1.9/lib/python3.4/site-packages/image_cropping/init.py", line 1, in from .fields import ImageRatioField, ImageCropField File "/opt/pyvirtual/py_3.4-dj_1.9/lib/python3.4/site-packages/image_cropping/fields.py", line 5, in from .widgets import ImageCropWidget File "/opt/pyvirtual/py_3.4-dj_1.9/lib/python3.4/site-packages/image_cropping/widgets.py", line 4, in from django.db.models import get_model, ObjectDoesNotExist ImportError: cannot import name 'get_model'

so please provide me solution for this or any alternative.

shacker commented 8 years ago

Under Django 1.9rc1, it fails with

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

(just using the basic/starter tutorial instructions).

Dharmik8478 commented 8 years ago

I have same error on django 1.9rc1

fritz-k commented 8 years ago

django.core.exceptions.AppRegistryNotReady masks the original exception. Try running runserver with --noreload option (see https://code.djangoproject.com/ticket/25634 for details). Also, same problem for me. Edit: Swapping django.db.models.get_model for django.apps.apps.get_model we're back at

$ python manage.py runserver --noreload
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
    utility.execute()
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/django/core/management/__init__.py", line 324, in execute
    django.setup()
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/usr/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 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "../image_cropping/__init__.py", line 1, in <module>
    from .fields import ImageRatioField, ImageCropField
  File "../image_cropping/fields.py", line 5, in <module>
    from .widgets import ImageCropWidget
  File "../image_cropping/widgets.py", line 10, in <module>
    from easy_thumbnails.files import get_thumbnailer
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/easy_thumbnails/files.py", line 14, in <module>
    from easy_thumbnails import engine, exceptions, models, utils, signals, storage
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/easy_thumbnails/models.py", line 48, in <module>
    class File(models.Model):
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/django/db/models/base.py", line 94, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
    self.check_apps_ready()
  File "/home/fritz/.pyvenvs/testing/lib/python3.5/site-packages/django/apps/registry.py", line 124, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

with django 1.9 (final), python 3.5 and the django-image-cropping example project cloned from this repo.

anrie commented 8 years ago

We haven't switched to 1.9 yet and are quite busy at the moment so we didn't have the chance to examine this closer.

I opened a Django 1.9 branch (https://github.com/jonasundderwolf/django-image-cropping/tree/django-19) and fixed the glaring issues. The example project seems to run now, however the tests are still failing. If anyone fixes the remaining issues, we're glad to see a PR.

fritz-k commented 8 years ago

Thanks for the quick fixes! For the Django 1.9 tests to pass, you need to update django-webtest requirements to 1.7.8. No idea why travis fails though. Locally only the combo python 2.7 and Django 1.9 failed.

Dharmik8478 commented 8 years ago

Ok great, thanks for fixing it...