小编dre*_*lio的帖子

Google App Engine Remote API无法在本地客户端上运行

这是使用Python SDK版本1.8.0.

我的远程API工作正常remote_api_shell.py,但在尝试从python脚本中访问时不起作用.我正在使用谷歌示例代码:

from google.appengine.ext.remote_api import remote_api_stub
import getpass

def auth_func():
  return (raw_input('Username:'), getpass.getpass('Password:'))

remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', auth_func,
                               'localhost:8080')
Run Code Online (Sandbox Code Playgroud)

而且我也导入fix_sys_path()dev_appserver.py设置我sys.path正确的谷歌应用程序引擎SDK:

import dev_appserver
dev_appserver.fix_sys_path()
Run Code Online (Sandbox Code Playgroud)

除了其他路径之外,我还将以下行添加到sys.path:

'/google_appengine_1.8.0/lib/fancy_urllib'
Run Code Online (Sandbox Code Playgroud)

但是,调用上面的调用时会抛出以下错误remote_api_stub.ConfigureRemoteApi():

opener.add_handler(fancy_urllib.FancyProxyHandler())
AttributeError: 'module' object has no attribute 'FancyProxyHandler'
Run Code Online (Sandbox Code Playgroud)

python google-app-engine remoteapi google-cloud-platform

11
推荐指数
1
解决办法
1292
查看次数

如何导入在Typescript中使用module.exports =的CommonJS模块

以下产生有效的工作ES5但发出以下错误.我正在使用Typescript 1.7.5,我想我已经阅读了整个语言规范,我无法弄清楚为什么会产生这个错误.

error TS2349: Cannot invoke an expression whose type lacks a call signature.
Run Code Online (Sandbox Code Playgroud)

a.js(默认导出的ES5环境模块)

function myfunc() {
  return "hello";
}
module.exports = myfunc;
Run Code Online (Sandbox Code Playgroud)

ADTS

declare module "test" {
    export default function (): string;
}
Run Code Online (Sandbox Code Playgroud)

b.ts

import test = require("test");
const app = test();
Run Code Online (Sandbox Code Playgroud)

b.js(生成的ES5):

var test = require("test");
var app = test()
Run Code Online (Sandbox Code Playgroud)

typescript ecmascript-6 typescript1.7

10
推荐指数
1
解决办法
3941
查看次数

当服务器绑定到特定IP(不是localhost)时,如何使Google App Engine python SDK Remote API与本地开发服务器一起使用?

使用远程api(remote_api_shell.py)在生产服务器上正常工作.但是,它仅适用于开发服务器上的开发服务器localhost.当服务器在特定IP上运行时(例如,dev_appserver.py --host=192.168.0.1),它不起作用.

这是使用Python SDK.我确信这适用于版本1.7.5.它不适用于1.7.61.8.0.

这是一个特定的案例:

运行服务器并将其绑定到默认地址(localhost:8080):

/path/to/dev_appserver.py myapp/app.yaml
INFO     2013-05-25 19:11:15,071 sdk_update_checker.py:244] Checking for updates to the SDK.
INFO     2013-05-25 19:11:15,323 api_server.py:152] Starting API server at: http://localhost:39983
INFO     2013-05-25 19:11:15,403 dispatcher.py:98] Starting server "default" running at: http://localhost:8080
INFO     2013-05-25 19:11:15,405 admin_server.py:117] Starting admin server at: http://localhost:8000
Run Code Online (Sandbox Code Playgroud)

启动远程API shell,它工作正常:

$ ./remote_api_shell.py -s localhost:8080
Email: x@x
Password: 
App Engine remote_api shell
Python 2.7.2+ (default, Jul 20 2012, 22:15:08) …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine

3
推荐指数
1
解决办法
2865
查看次数