Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I am getting this error. I tried with migrate --fake default but it doesn't seems to be working. attached is output of "python manage.py migrate" My set up is Django 1.6 + celery3.1.12 + postgresql + gunicorn on OneBSD VPS.

Running migrations for users:


- Migrating forwards to 0007_auto__del_field_profile_weekly_digest__del_field_profile_daily_digest_.
 > users:0001_initial
FATAL ERROR - The following SQL query failed: CREATE TABLE "users_user" ("id" serial NOT NULL PRIMARY KEY, "password" varchar(128) NOT NULL, "last_login" timestamp with time zone NOT NULL, "email" varchar(255) NOT NULL UNIQUE, "name" varchar(255) NOT NULL, "is_active" boolean NOT NULL, "is_admin" boolean NOT NULL, "is_staff" boolean NOT NULL, "type" integer NOT NULL, "status" integer NOT NULL, "new_messages" integer NOT NULL, "badges" integer NOT NULL, "score" integer NOT NULL, "full_score" integer NOT NULL, "flair" varchar(15) NOT NULL, "site_id" integer NULL)
The error was: relation "users_user" already exists

Error in migration: users:0001_initial
Traceback (most recent call last):
  File "manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/home/jay/biostar-central/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
    ignore_ghosts = ignore_ghosts,
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/migration/migrators.py", line 254, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/migration/migrators.py", line 329, in migrate_many
    result = self.migrate(migration, database)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
    result = self.run(migration, database)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/migration/migrators.py", line 114, in run
    return self.run_migration(migration, database)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/migration/migrators.py", line 84, in run_migration
    migration_function()
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/migration/migrators.py", line 60, in <lambda>
    return (lambda: direction(orm))
  File "/home/jay/biostar-central/biostar/apps/users/migrations/0001_initial.py", line 28, in forwards
    ('site', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sites.Site'], null=True)),
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/db/generic.py", line 47, in _cache_clear
    return func(self, table, *args, **opts)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/db/generic.py", line 361, in create_table
    "columns": ', '.join([col for col in columns if col]),
  File "/home/jay/biostar-central/lib/python2.7/site-packages/south/db/generic.py", line 282, in execute
    cursor.execute(sql, params)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/jay/biostar-central/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "users_user" already exists
share|improve this question
up vote 0 down vote accepted

If python manage.py migrate --fake-initial doesn't work, you could try to delete migration folder from your app and create new one by:

python manage.py makemigrations app_name
share|improve this answer
    
Thanks you very much. – Jay Patel Oct 1 '16 at 13:03
    
No problem :) good luck – Anatoly Strashkevich Oct 1 '16 at 13:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.