1

我正在测试将 NonRel for App Engine 从 1.3 升级到 1.4。它在本地运行良好,但是当我部署到 App Engine 时,在部署结束时出现 syncdb 错误:

Running syncdb.
2013-08-02 09:31:34,600 WARNING simple_search_stub.py:998 Could not read search indexes from /var/folders/fv/cdp4hprx5pbc_3bf5g0wbbkw0000gn/T/dev_appserver.searchindexes
Creating tables ...
The following content types are stale and need to be deleted:

    auth | message

Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.

    Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
  File "manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/src/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute() 
  File "/src/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/src/djangoappengine/management/commands/deploy.py", line 72, in run_from_argv
    run_appcfg(argv)
  File "/src/djangoappengine/management/commands/deploy.py", line 51, in run_appcfg
    call_command('syncdb', remote=True, interactive=True)
  File "/src/django/core/management/__init__.py", line 150, in call_command
    return klass.execute(*args, **defaults)
  File "/src/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/src/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/src/django/core/management/commands/syncdb.py", line 110, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/src/django/core/management/sql.py", line 189, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "/src/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/src/django/contrib/contenttypes/management.py", line 67, in update_contenttypes
    ct.delete()
  File "/src/django/db/models/base.py", line 599, in delete
    collector.delete()
  File "/src/django/db/models/deletion.py", line 61, in decorated
    func(self, *args, **kwargs)
  File "/src/django/db/models/deletion.py", line 261, in delete
    query.delete_batch([obj.pk for obj in instances], self.using, field)
  File "/src/django/db/models/sql/subqueries.py", line 44, in delete_batch
    self.do_query(self.model._meta.db_table, where, using=using)
  File "/src/django/db/models/sql/subqueries.py", line 29, in do_query
    self.get_compiler(using).execute_sql(None)
  File "/src/djangotoolbox/db/basecompiler.py", line 593, in execute_sql
    self.build_query([self.query.get_meta().pk]).delete()
  File "/src/djangoappengine/db/compiler.py", line 69, in _func
    return func(*args, **kwargs)
  File "/src/djangoappengine/db/compiler.py", line 168, in delete
    Delete(keys)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 695, in Delete
    return DeleteAsync(keys, **kwargs).get_result()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 674, in DeleteAsync
    keys, _ = NormalizeAndTypeCheckKeys(keys)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 176, in NormalizeAndTypeCheckKeys
    keys, multiple = NormalizeAndTypeCheck(keys, (basestring, Entity, Key))
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 143, in NormalizeAndTypeCheck
    arg_list = list(arg)
  File "/src/djangoappengine/db/compiler.py", line 105, in fetch
    query = self._build_query()
  File "/src/djangoappengine/db/compiler.py", line 69, in _func
    return func(*args, **kwargs)
  File "/src/djangoappengine/db/compiler.py", line 322, in _build_query
    return MultiQuery(self.gae_query, self.ordering)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 1998, in __init__
    'MultiQuery does not support keys_only.')
django.db.utils.DatabaseError: MultiQuery does not support keys_only.

我可以通过删除本地开发服务器上的内容类型来解决它,但我想知道为什么会出现此错误。我确实理解异常的含义,但不明白为什么 NonRel 没有调整 Django 以在 App Engine 中正确执行此操作?

4

2 回答 2

0

我遇到了一个类似的错误你能试试吗

./manage.py sqlflush

于 2015-02-11T21:12:22.217 回答
0

这可能是 djangoappengine 编译器路径中的一个错误,该编译器使用不多。几个月前还有另一个与删除相关的错误:

https://groups.google.com/forum/#!searchin/django-non-relational/delete/django-non-relational/Eb6K7fVYrhM/_QmLPtbIfmMJ

话虽如此,我什至不确定为什么 djangoappengine 在部署时根本运行 syncdb。它在本地运行syncdb,而不是在生产服务器上。这似乎是不必要的,我怀疑它只是一些现有 django 代码路径的副产品。

于 2013-08-02T15:58:25.113 回答