Hi,
I have a legacy database and used "python manage.py inspectdb > models.py"
to create a models.py file. After I modified the file all errors went away
when I makemigrations. This step works without problems on the only app I
have in my project. When I go "python manage.py migrate" I get the
following error.
Operations to perform:
Synchronize unmigrated apps: staticfiles, messages
Apply all migrations: admin, contenttypes, sessions, auth, readDatabase
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying readDatabase.0001_initial...Traceback (most recent call last):
File
"/home/christoph_knapp/Bioinformatik/variantendatenbank_tool/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 351, in execute_from_command_line
utility.execute()
File
"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
line 343, 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 394, in run_from_argv
self.execute(*args, **cmd_options)
File
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
line 445, in execute
output = self.handle(*args, **options)
File
"/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py",
line 222, 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 110, in migrate
self.apply_migration(states[migration], migration, fake=fake,
fake_initial=fake_initial)
File
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py",
line 148, in apply_migration
state = migration.apply(state, schema_editor)
File
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py",
line 115, in apply
operation.database_forwards(self.app_label, schema_editor, old_state,
project_state)
File
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/models.py",
line 59, in database_forwards
schema_editor.create_model(model)
File
"/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py",
line 286, in create_model
self.execute(sql, params or None)
File
"/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py",
line 111, 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
97, 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
62, in execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: FEHLER: Relation „auth_group“ existiert
bereits
The last line contains a little bit of German which translates into
"Relation "auth_group" already exists". The auth_group table was generated
by inspectdb and is none of the tables from the legacy database. The only
change I made at those tables were that I removed the line "managed=False".
When I put this back in I get the same error. The python code for the
auth_group table is below.
class AuthGroup(models.Model):
name = models.CharField(unique=True, max_length=80)
class Meta:
db_table = 'auth_group'
I just started with django, so let me know whether you need anything else.
Regards
Christoph
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/a87703ec-cc25-4404-accf-e5cd800e23c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.