DatabaseError:没有这样的表

时间:2013-05-23 14:10:10

标签: django django-admin

在这里疯了。

所以在这里,追溯:

Traceback (most recent call last):

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/contrib/admin/options.py", line 366, in wrapper
   return self.admin_site.admin_view(view)(*args, **kwargs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
   response = view_func(request, *args, **kwargs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/views/decorators/cache.py", line 89, in _wrapped_view_func
   response = view_func(request, *args, **kwargs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/contrib/admin/sites.py", line 196, in inner
   return view(request, *args, **kwargs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/utils/decorators.py", line 25, in _wrapper
   return bound_func(*args, **kwargs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
   response = view_func(request, *args, **kwargs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/utils/decorators.py", line 21, in bound_func
   return func(self, *args2, **kwargs2)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/db/transaction.py", line 224, in inner
   return func(*args, **kwargs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/contrib/admin/options.py", line 1274, in delete_view
   [obj], opts, request.user, self.admin_site, using)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/contrib/admin/util.py", line 104, in get_deleted_objects
   collector.collect(objs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/contrib/admin/util.py", line 155, in collect
   return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/db/models/deletion.py", line 175, in collect
   if not sub_objs:

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/db/models/query.py", line 130, in __nonzero__
   iter(self).next()

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/db/models/query.py", line 118, in _result_iter
   self._fill_cache()

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/db/models/query.py", line 892, in _fill_cache
   self._result_cache.append(self._iter.next())

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/db/models/query.py", line 291, in iterator
   for row in compiler.results_iter():

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 763, in results_iter
   for rows in self.execute_sql(MULTI):

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 818, in execute_sql
   cursor.execute(sql, params)

 File "/var/www/phaethon/virtualenvs/my_random_website/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py", line 344, in execute
   return Database.Cursor.execute(self, query, params)

DatabaseError: no such table: orders_orderline

奇怪的是,这只会在管理员视图中显示,即:

http://www.myrandomsite.gr/admin/store/product/138/delete/

如果我从./manage.py shell启动shell,我可以在对象上调用.delete()就好了。

另一个奇怪的是,它在我的本地机器上运行正常。它只发生在apache部署上。我有几个网站使用相同的东西,工作得很好。

我正在镜像应用程序,python版本和数据库。我尝试重新创建一切,virtualenv,db等。

到处尝试ack'ing以查看orders_orderline的定义位置。它只是我项目中的另一个应用程序,未在INSTALLED_APPS或任何地方设置。我只在特定视图(模型OrderLine)中使用它,只有在安装了应用程序时才导入。

编辑:我sqlite3 mydb,我也找不到对该表的任何引用,因为它首先不应该存在,管理员在哪里拿起它?

edit2:只有在设置DEBUG,TEMPLATE_DEBUG = FALSE

时才会发生这种情况

0 个答案:

没有答案