tags:

views:

66

answers:

1

I had to remove my Django Database (drop all the tables). Now when I try to run "manage.py syncdb" to recreate those tables I get the message "Table 'user_database.engine.city' doesn't exist"

Is there a file lingering that is telling djnago these tables still exist?

EDITED QUESTION:

I had to remove my Django Database (drop all the tables). Now when I try to run "manage.py syncdb" to recreate those tables I get the message "Table 'username_database.engine_city' doesn't exist"

Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/home4/username/.local/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/home4/username/.local/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home4/username/.local/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home4/username/.local/lib/python2.6/site-packages/django/core/management/base.py", line 209, in execute
translation.activate('en-us')
File "/home4/username/.local/lib/python2.6/site-packages/django/utils/translation/__init__.py", line 66, in activate
return real_activate(language)
File "/home4/username/.local/lib/python2.6/site-packages/django/utils/functional.py", line 55, in _curried
return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
File "/home4/username/.local/lib/python2.6/site-packages/django/utils/translation/__init__.py", line 36, in delayed_loader
return getattr(trans, real_name)(*args, **kwargs)
File "/home4/username/.local/lib/python2.6/site-packages/django/utils/translation/trans_real.py", line 193, in activate
_active[currentThread()] = translation(language)
File "/home4/username/.local/lib/python2.6/site-packages/django/utils/translation/trans_real.py", line 176, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/home4/username/.local/lib/python2.6/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/home4/username/.local/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home4/username/.local/lib/python2.6/site-packages/massivecoupon/engine/views.py", line 12, in <module>
File "/home4/username/.local/lib/python2.6/site-packages/deals/engine/forms.py", line 40, in <module>
class EmailSubForm(forms.Form):
File "/home4/username/.local/lib/python2.6/site-packages/deals/engine/forms.py", line 42, in EmailSubForm
city                = forms.ChoiceField(initial=1, choices=[ (obj.id, obj.name) for obj in enginemodels.City.objects.all() ])
File "/home4/username/.local/lib/python2.6/site-packages/django/db/models/query.py", line 106, in _result_iter
self._fill_cache()
File "/home4/username/.local/lib/python2.6/site-packages/django/db/models/query.py", line 760, in _fill_cache
self._result_cache.append(self._iter.next())
File "/home4/username/.local/lib/python2.6/site-packages/django/db/models/query.py", line 269, in iterator
for row in compiler.results_iter():
File "/home4/username/.local/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 672, in results_iter
for rows in self.execute_sql(MULTI):
File "/home4/username/.local/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 727, in execute_sql
cursor.execute(sql, params)
File "/home4/username/.local/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 86, in execute
return self.cursor.execute(query, args)
File "/home4/username/.local/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-linux-x86_64.egg/MySQLdb/cursors.py", line 174, in execute
File "/home4/username/.local/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-linux-x86_64.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
django.db.utils.DatabaseError: (1146, "Table 'username_enjoy.engine_city' doesn't exist")

Is there a file lingering that is telling djnago these tables still exist?

A: 

Looks like during model validation your massivecoupon module is doing some imports which trigger the deals module to fill it's cache.

imports in python actually execute code in the imported module, and this is a classic case of poorly coded import routines having unintended consequences

what i would suggest is trimming down the list of installed apps to just the django basics, syncdb, then start adding back apps one at a time with a syncdb in between each.

this will hopefully create the table that the import relies upon before importing that app.

Good luck.

Thomas