I'm trying to upgrade from Django 1.6.7 to 1.7.1
However, after upgrading the Django version in my local virtualenv
and all my own Django apps (for which the new migrate
works), I cannot get migrate
for the easy_thumbnails
app (version 2.2) to work. This version should work properly with the new migrations system (post South) in Django 1.7 (instructions here).
As far as I can tell, the reason is that the second migration in the easy_thumbnails
app is trying to recreate the migration (source code here).
But naturally, since this code is intentionally there by the package authors, I'm afraid am doing something wrong myself.
Any ideas what the cause of this is?
Full stack trace:
./manage.py migrate easy_thumbnails --settings=[my.settings.module]
Operations to perform:
Apply all migrations: easy_thumbnails
Running migrations:
Applying easy_thumbnails.0002_thumbnaildimensions...Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 63, in migrate
self.apply_migration(migration, fake=fake)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 97, in apply_migration
migration.apply(project_state, schema_editor)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 107, in apply
operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 36, in database_forwards
schema_editor.create_model(model)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/backends/schema.py", line 263, in create_model
self.execute(sql, params)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/backends/schema.py", line 99, in execute
cursor.execute(sql, params)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/virtualenvs/fsenv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "easy_thumbnails_thumbnaildimensions" already exists
The problem above was fixed by following these steps.
easy_thumbnails
migration (migration 0016
) using the command below:python manage.py migrate easy_thumbnails 0015 --settings=[your.settings.module]
- Soft matched migration 0015 to 0015_auto__del_unique_thumbnail_name_storage_hash__add_unique_thumbnail_sou.
Running migrations for easy_thumbnails:
- Migrating backwards to just after 0015_auto__del_unique_thumbnail_name_storage_hash__add_unique_thumbnail_sou.
< easy_thumbnails:0016_auto__add_thumbnaildimensions
pip install Django==1.7.1
) within the virtual envmigrate
; should work now