goapp serve:无法找到dev_appserver.py

时间:2014-01-18 00:42:15

标签: 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不起作用?

1 个答案:

答案 0 :(得分:3)

产生此错误消息的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")

因此,在使用goapp时,请仔细检查是否实际设置了APPENGINE_DEV_APPSERVER环境变量 例如,参见 设置该变量的gotool.bat脚本 (但是dsymonds正确地points out你不应该直接设置它,你应该总是使用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 %*