Opened 16 years ago
Closed 16 years ago
#7953 closed (invalid)
django contenttypes post_sync breaking syncdb (again)
Reported by: | mspang | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.0-alpha |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Got this error:
$ ./manage.py syncdb
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
[...]
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): no
Traceback (most recent call last):
File "/home/mspang/django/interblag/manage.py", line 14, in main
mgr.execute()
File "/home/mspang/django/1.0/core/management/init.py", line 248, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/mspang/django/1.0/core/management/base.py", line 77, in run_from_argv
self.execute(*args, options.dict)
File "/home/mspang/django/1.0/core/management/base.py", line 91, in execute
output = self.handle(*args, options)
File "/home/mspang/django/1.0/core/management/base.py", line 173, in handle
return self.handle_noargs(options)
File "/home/mspang/django/1.0/core/management/commands/syncdb.py", line 108, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive)
File "/home/mspang/django/1.0/core/management/sql.py", line 489, in emit_post_sync_signal
verbosity=verbosity, interactive=interactive)
File "/home/mspang/django/1.0/dispatch/dispatcher.py", line 358, in send
sender=sender,
File "/home/mspang/django/1.0/dispatch/robustapply.py", line 47, in robustApply
return receiver(*arguments, named)
File "/home/mspang/django/1.0/contrib/auth/management/init.py", line 26, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
File "/home/mspang/django/1.0/contrib/contenttypes/models.py", line 28, in get_for_model
defaults = {'name': smart_unicode(opts.verbose_name_raw)},
File "/home/mspang/django/1.0/db/models/manager.py", line 85, in get_or_create
return self.get_query_set().get_or_create(kwargs)
File "/home/mspang/django/1.0/db/models/query.py", line 325, in get_or_create
return self.get(kwargs), False
File "/home/mspang/django/1.0/db/models/query.py", line 297, in get
num = len(clone)
File "/home/mspang/django/1.0/db/models/query.py", line 153, in len
self._result_cache = list(self.iterator())
File "/home/mspang/django/1.0/db/models/query.py", line 268, in iterator
for row in self.query.results_iter():
File "/home/mspang/django/1.0/db/models/sql/query.py", line 204, in results_iter
for rows in self.execute_sql(MULTI):
File "/home/mspang/django/1.0/db/models/sql/query.py", line 1608, in execute_sql
cursor.execute(sql, params)
File "/home/mspang/django/1.0/db/backends/util.py", line 18, in execute
return self.cursor.execute(sql, params)
File "/home/mspang/django/1.0/db/backends/sqlite3/base.py", line 144, in execute
return Database.Cursor.execute(self, query, params)
pysqlite2.dbapi2.OperationalError: no such table: django_content_type
I didn't have django.contrib.contenttypes in INSTALLED_APPS at the time, but adding it made
the problem go away.
You say "again" in the summary as if this is a re-occurrence of a previously-fixed bug but give no pointers to any old bug like this. For those of us not around since day 1 or perhaps with not the greatest memories, it would be helpful if you actually identified any previous identical bugs.
As it is, as mentioned here: http://www.djangoproject.com/documentation/contenttypes/
the auth framework requires contenttypes. The syncdb output indicates you've got auth in your INSTALLED_APPs. Therefore you need contenttypes also. Since you didn't have it, you got an error. Adding contenttypes fixed the eerror. What's the problem?