0

After upgrading django from 1.10 to 1.11, I can't use the manage.py command. There are so many errors that I do not even know where to start and where to look for the cause of errors. I will be grateful for any help.

I paste all errors below.

  File "SAGI-B/manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/filer/models/__init__.py", line 3, in <module>
    from .clipboardmodels import *  # flake8: noqa
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/filer/models/clipboardmodels.py", line 9, in <module>
    from . import filemodels
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/filer/models/filemodels.py", line 18, in <module>
    from ..fields.multistorage_file import MultiStorageFileField
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/filer/fields/multistorage_file.py", line 12, in <module>
    from easy_thumbnails import fields as easy_thumbnails_fields
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/easy_thumbnails/fields.py", line 2, in <module>
    from easy_thumbnails import files
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/easy_thumbnails/files.py", line 14, in <module>
    from easy_thumbnails import engine, exceptions, models, utils, signals, storage
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/easy_thumbnails/engine.py", line 12, in <module>
    from easy_thumbnails import utils
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/easy_thumbnails/utils.py", line 15, in <module>
    from easy_thumbnails.conf import settings
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/easy_thumbnails/conf.py", line 334, in <module>
    settings = Settings()
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/easy_thumbnails/conf.py", line 21, in __init__
    super(AppSettings, self).__init__(*args, **kwargs)
TypeError: __init__() takes exactly 2 arguments (1 given)

I have upgraded all dependencies with the command pip list --outdated --format = freeze | grep -v '^ \ - e' | cut -d = -f 1 | xargs -n1 pip install -U, which I found here: enter link description here

Now the number of errors has decreased to a few. I paste them below.

Traceback (most recent call last):
  File "SAGI-B/manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/marcin/.vens/sagi/local/lib/python2.7/site-packages/cmsplugin_filer_file/models.py", line 10, in <module>
    from filer.utils.compatibility import python_2_unicode_compatible
ImportError: cannot import name python_2_unicode_compatible
nsog8sm43x
  • 329
  • 5
  • 14
  • It looks like its in a third party package, you should look at upgrading that – Sayse Jan 13 '20 at 15:39
  • You need to upgrade the 'easy-thumbnails' package to 2.5.0 or later according to the CHANGES file. https://github.com/SmileyChris/easy-thumbnails/blob/master/CHANGES.rst – youngminz Jan 13 '20 at 16:00
  • 2
    Always look at the error trace from bottom to top. This particular message tells you that `Settings()` can't be initialised like that, because the super class requires an additional parameter in its initialiser. So probably 'easy-thumbnails' version you have isn't compatible with django 1.11. I would advise you to skip Django 1.11 and go directly to 2.2 (which is the current LTS version). You will encounter new issues going from 1.11 to 2.2 (which you need to do before april). – dirkgroten Jan 13 '20 at 16:05
  • 1
    @dirkgroten my own experience with django upgrades is that it's usually easier to go through all the "intermediary" versions - it's boring for sure, but at least you don't have too many changes at once, and you can just follow the changelist for each version. IIRC this also was the official Django recommandation (but don't ask me to find a reference to this ) – bruno desthuilliers Jan 13 '20 at 16:14
  • 1
    @dirkgroten well I found it nonetheless: "If you’re upgrading through more than one feature version (e.g. A.B to A.B+2), it’s usually easier to upgrade through each feature release incrementally (A.B to A.B+1 to A.B+2) rather than to make all the changes for each feature release at once. For each feature release, use the latest patch release (A.B.C)." (https://docs.djangoproject.com/en/3.0/howto/upgrade-version/) – bruno desthuilliers Jan 13 '20 at 16:17
  • @brunodesthuilliers good one. I'm just not sure all 3rd party packages latest versions will work with django 1.11 (they should but I know of some that don't), which might render things tricky. – dirkgroten Jan 13 '20 at 16:18
  • FYI, if your test coverage is good enough, an upgrade that skips the version won't be that hard. I have succeeded in bringing a large project with adequate test coverage from 1.11 to 2.2 all at once. The upgrade from 1.8 to 1.11 when the test coverage was not sufficient was quite laborious. – youngminz Jan 13 '20 at 16:20
  • @dirkgroten you of course have to skim through all your deps and find the latest _compatible_ version (compatible with the current target). – bruno desthuilliers Jan 13 '20 at 16:21
  • @OP : Django releases come with [a detailed "release notes" page](https://docs.djangoproject.com/en/3.0/releases/1.11/), including [incompatible changes listing](https://docs.djangoproject.com/en/3.0/releases/1.11/#backwards-incompatible-1-11) and [a link to recommanded upgrade plan & best practices](https://docs.djangoproject.com/en/3.0/howto/upgrade-version/). Did you read all this and followed instructions ? [Obviously not](https://docs.djangoproject.com/en/3.0/howto/upgrade-version/#dependencies). – bruno desthuilliers Jan 13 '20 at 16:25
  • @youngminz 1.11 to 2.2 should be straight forward because it's LTS - LTS. The danger of jumping from 1.10 to 2.2 is that you miss the deprecations added in Django 1.11. – Alasdair Jan 13 '20 at 16:46

1 Answers1

1

Your pip install -U command has upgraded easy-thumbnails to 2.7.0, but that version dropped support for Django 1.11.X

Support for Django 1.11 was added in 2.5.0, so either 2.5.0 or 2.6.0 should work (depending on other requirements). You could install 2.6 with:

pip install --upgrade "easy-thumbnails<2.7.0"
Alasdair
  • 298,606
  • 55
  • 578
  • 516