A
A
Andrey2015-12-16 06:29:34
Django
Andrey, 2015-12-16 06:29:34

Django 1.9 migrate why is it throwing an error?

Hello!
Installed Django 1.9, created a clean database (PostgreSQL), do manage.py migrate and get:

Operations to perform:
  Apply all migrations: sessions, admin, sites, auth, contenttypes, post_office
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying admin.0001_initial...Traceback (most recent call last):
  File "mysite/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 342, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 200, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 92, in migrate
    self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 121, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 198, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", line 90, in __exit__
    self.execute(sql)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", line 110, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "users_user" does not exist

The project is not new! For the sake of interest, I rolled back to Django 1.8.6, everything works, but with 1.9 such an error!
Please tell me where to look, how to fix it ?!
UDP: Did makemigrations <enumerated my applications> then migrate and everything went without errors, but the table for sorl-thumbnail was not created.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
zigen, 2015-12-30
@zigen

In django 1.9 you need to run:

manage.py makemigrations thumbnail
manage.py migrate

R
Rikcon, 2015-12-16
@Rikcon

django.db.utils.ProgrammingError: relation "users_user" does not exist

No users_user connection, check your migrations.

Y
Yeldos Adetbekov, 2016-05-30
@dosya97

Try
As a last resort, go to the migrations folder of the application that swears and find those migration files and delete them from it to the end. And

python manage.py makemigrations
python manage.py migrate

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question