【问题标题】:django non rel and google app engine: remote api issuedjango non rel 和谷歌应用引擎:远程 api 问题
【发布时间】:2011-02-28 03:52:53
【问题描述】:

我正在 Google App Engine 上部署一个 django-nonrel 应用程序。该应用程序部署正常,但我无法登录远程外壳。

这是我的 app.yaml 文件:

application: masnun
version: 1
runtime: python
api_version: 1

builtins:
- remote_api: on

inbound_services:
- warmup

handlers:
- url: /_ah/queue/deferred
  script: djangoappengine/deferred/handler.py
  login: admin

- url: /media/admin
  static_dir: django/contrib/admin/media
  expiration: '0'

- url: /.*
  script: djangoappengine/main/main.py

但我收到一个错误:

urllib2.URLError: <urlopen error HTTP Error 500: Internal Server Error
Couldn't reach remote_api handler at https://masnun.appspot.com/_ah/remote_api(/.*)?.
Make sure you've deployed your project and installed a remote_api handler in app.yaml.>

请帮帮我!

更新:使用Python2.5时,出现这个错误:

DEBUG:google.appengine.tools.appengine_rpc:Got http error, this is try #3
DEBUG:google.appengine.tools.appengine_rpc:Sending HTTPS request:
GET /_ah/remote_api(/.*)? HTTPS/1.1
Host: masnun.appspot.com
X-appcfg-api-version: 1
Content-type: application/octet-stream
User-agent: Google-remote_api/1.0 Linux/2.6.35-25-generic Python/2.5.5.final.0

【问题讨论】:

  • 你在运行什么命令?看起来您正在传递要获取的 URL 的正则表达式。
  • python manage.py deploy python manage.py remote 在这两种情况下都失败。

标签: python google-app-engine django-nonrel


【解决方案1】:

将此添加到 app.yaml 部分处理程序,第一项:

处理程序: - 网址:/remote_api 脚本:$PYTHON_LIB/google/appengine/ext/remote_api/handler.py 登录:管理员

然后再次部署。

【讨论】:

    【解决方案2】:

    问题出在

    GET /_ah/remote_api(/.*)? HTTPS/1.1

    如果您注意到,URL 包含无效字符“(/.*)?”接近尾声。

    假设您使用的是 django-nonrel,这很容易解决。打开文件

    djangoappengine/db/base.py
    

    换行

    self.remote_api_path = handler.url
    

    self.remote_api_path = handler.url.split('(')[0] # remove '(/.*)' introduced in newer GAE
    

    这应该注意确保 URL 正确。

    【讨论】:

    • 我不再从事该项目。不过,谢谢你的回复,我接受了:)
    【解决方案3】:

    您可以使用连接到远程外壳

    python manage.py remote shell
    

    并且仅当您使用 Google 帐户身份验证创建 App Engine 应用时。但是 remote_api 需要一个已部署的应用程序,并且因为您的

    python manage.py deploy
    

    失败,以上错误是正常的。

    尝试部署时遇到什么错误?

    【讨论】:

      猜你喜欢
      • 2013-09-29
      • 1970-01-01
      • 1970-01-01
      • 2012-03-21
      • 1970-01-01
      • 2013-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多