Django / South表/列不存在

时间:2014-02-04 16:36:31

标签: python django python-2.7

我知道那里有类似的问题,但我已经完成了所有这些问题无济于事。

我不知道我对南方移民历史做了什么。我们团队中的另一个人包括第三方应用程序。我尝试使用南方来同步它 - 我现在无法真正给你步骤,因为我已经初始化和伪造并删除了很多不同组合中的幽灵迁移,我无法想象它是如何搞砸了我做了一些东西。

无论如何,我得到了各种各样的'表,如此不存在'或'没有这样的专栏'等。虽然我不想删除我的数据库并重新开始,但如果没有更好的选择,这是一个选择(但是,我似乎无法弄清楚如何做到这一点)。

因为它是导致问题的第三方应用程序,所以我似乎无法找到首先存储它的迁移的位置。

这是最新的堆栈跟踪。我迷路了。 Python 2.7,Django 1.5

环境:

Request Method: POST
Request URL: `http://localhost:8000/application/29828/edit`

Django Version: 1.6.1
Python Version: 2.7.2
Installed Applications:
('suit',
 'south',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.redirects',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'rest_framework',
 'ldap_sync',
 'crispy_forms',
 'ownership.apps.Catalog',
 'ownership.apps.Assets',
 'ownership.apps.Shared',
 'ownership.libs.display',
 'django_tables2',
 'haystack',
 'autocomplete_light',
 'reversion',
 'debug_toolbar')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
 'django.middleware.transaction.TransactionMiddleware',
 'reversion.middleware.RevisionMiddleware',
 'ownership.libs.middleware.LoginRequiredMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware')


Traceback:
~~~
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  201.                 response = middleware_method(request, response)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/reversion/middleware.py" in process_response
  37.         self._close_revision(request)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/reversion/middleware.py" in _close_revision
  28.             revision_context_manager.end()
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/reversion/revisions.py" in end
  182.                             db = self._db,
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/reversion/revisions.py" in save_revision
  435.             for obj in self._follow_relationships(objects.keys()):
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/reversion/revisions.py" in _follow_relationships
  412.             _follow(obj)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/reversion/revisions.py" in _follow
  409.             for related in adapter.get_followed_relations(obj):
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/reversion/revisions.py" in get_followed_relations
  74.                 for related_obj in related.all():
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/models/query.py" in __iter__
  96.         self._fetch_all()
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
  854.             self._result_cache = list(self.iterator())
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/models/query.py" in iterator
  220.         for row in compiler.results_iter():
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter
  710.         for rows in self.execute_sql(MULTI):
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  781.         cursor.execute(sql, params)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/debug_toolbar/utils/tracking/db.py" in execute
  91.             return self.cursor.execute(sql, params)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  69.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  99.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in execute
  124.             return self.cursor.execute(query, args)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/MySQLdb/cursors.py" in execute
  201.             self.errorhandler(self, exc, value)
File "/Users/nicholsp/.virtualenvs/ownership/lib/python2.7/site-packages/MySQLdb/connections.py" in defaulterrorhandler
  36.     raise errorclass, errorvalue

Exception Type: ProgrammingError at /application/29828/edit
Exception Value: (1146, "Table 'ownershipdb.assets_itemrelationship' doesn't exist")

~~~

1 个答案:

答案 0 :(得分:1)

您需要在失败的迁移中设置depends_on属性。应将其设置为某些迁移,以确保已创建缺失的表。