I deleted the database and installed a new one with no tables at all.
Using regular Python I ran the script manage.py with subcommand
syncdb. It created the first 4 tables then hit an error. Here is the
traceback for the error.
Traceback (most recent call last):
File "manage.py", line 32, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/
__init__.py", line 438, in execute_manager utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/
__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/
base.py", line 191, in run_from_argv self.execute(*args,
**options.__dict__)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/
base.py", line 218, in execute output = self.handle(*args, **options)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/
base.py", line 347, in handle return self.handle_noargs(**options)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/
commands/syncdb.py", line 95, in handle_noargs
cursor.execute(statement)
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
mysql/base.py", line 86, in execute return self.cursor.execute(query,
args)
File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in
executeself.errorhandler(self, exc, value)
File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line
35,in default errorhandler raise errorclass, errorvalue
OperationalError: (1060, "Duplicate column name
'taxonomy_kingdom_id'")
Does this mean that when it tries to create the table
slide_taxonomykingdom there is already a column with "id" and its
trying to make another one?
Here is the Python code that creates the two associated tables:
class TaxonomyKingdom(models.Model):
name = models.CharField(max_length=100, unique=True)
superior=0
def __unicode__(self):
return '%s' % (
self.name)
class TaxonomyPhylum(models.Model):
name = models.CharField(max_length=100, unique=True)
superior=taxonomy_kingdom = models.ForeignKey(TaxonomyKingdom,
null=True, blank=True)
def __unicode__(self):
return '%s' % (
self.name)