django non rel 和 google app engine:远程 api 问题

发布于 2024-10-19 15:32:31 字数 1184 浏览 6 评论 0原文

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

这是我的 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

I am deploying a django-nonrel app on Google App Engine. The app deploys alright but I can't login to the remote shell.

This is my app.yaml file:

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

But I am getting an error:

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.>

Please help me out!

Update: When using Python2.5, getting this error:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ㄟ。诗瑗 2024-10-26 15:32:32

问题在于

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 正确。

The problem is with

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

If you notice, the URL contains invalid characters "(/.*)?" towards the end.

Assuming you are using django-nonrel, it is an easy fix. Open the file

djangoappengine/db/base.py

and change the line

self.remote_api_path = handler.url

to

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

and that should take care of ensuring the URL is correct.

樱桃奶球 2024-10-26 15:32:32

您才可以使用连接到远程 shell

python manage.py remote shell

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

python manage.py deploy

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

当您尝试部署时出现什么错误?

You can connect to the remote shell using

python manage.py remote shell

and only if you created your App Engine app with Google Accounts Authentication. But remote_api requires a deployed app and since your

python manage.py deploy

fails, the above error is normal.

What error do you get when you try to deploy?

掩于岁月 2024-10-26 15:32:31

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

handlers:
- url: /remote_api
  script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
  login: admin

并再次部署。

Add this on app.yaml section handlers, first item:

handlers:
- url: /remote_api
  script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
  login: admin

and deploy again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文