goapp服务:找不到dev_appserver.py

Ger*_*ens 5 windows google-app-engine go

使用go 1.2 python 2.7和appengine 1.8.9

dev_appserver.py 在dos框中工作,位于Windows路径中。

goapp.exe 也可以在dos框中使用,并且位于Windows路径中。

知道为什么goapp.exe serve不起作用吗?

Von*_*onC 4

goapp/serve.go产生此错误消息(“ ”)的代码unable to find dev_appserver.py显示以下代码:

if p := os.Getenv("APPENGINE_DEV_APPSERVER"); p != "" {
  return p, nil
}
return "", fmt.Errorf("unable to find dev_appserver.py")
Run Code Online (Sandbox Code Playgroud)

因此,在使用 goapp 时,请仔细检查APPENGINE_DEV_APPSERVER是否实际设置了环境变量。
例如,请参阅此gotool.bat脚本,它确实设置了该变量
(但dsymmonds正确地指出您不应该直接设置它,您应该始终使用goapp):

@echo off
:: Copyright 2012 Google Inc. All rights reserved.
:: Use of this source code is governed by the Apache 2.0
:: license that can be found in the LICENSE file.
setlocal
set GOROOT=%~dp0\goroot
set APPENGINE_DEV_APPSERVER=%~dp0\dev_appserver.py
set GOARCH=
set GOBIN=
set GOOS=

:: Set a GOPATH if one is not set.
if not "%GOPATH%"=="" goto havepath
set GOPATH=%~dp0\gopath
:havepath

%GOROOT%\bin\%~n0.exe %*
Run Code Online (Sandbox Code Playgroud)