windows – goapp serve:无法找到dev_appserver.py

使用go 1.2 python 2.7和appengine 1.8.9

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

goapp.exe也可以在dos框中工作,位于windows路径中.

知道为什么goapp.exe服务不起作用?

解决方法

产生此错误消息的 goapp/serve.go(“无法找到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 %*

相关文章

文章浏览阅读2.2k次,点赞6次,收藏20次。在我们平时办公工作...
文章浏览阅读1k次。解决 Windows make command not found 和...
文章浏览阅读3.2k次,点赞2次,收藏6次。2、鼠标依次点击“计...
文章浏览阅读1.3w次。蓝光版属于高清版的一种。BD英文全名是...
文章浏览阅读974次,点赞7次,收藏8次。提供了更强大的功能,...
文章浏览阅读1.4w次,点赞5次,收藏22次。如果使用iterator的...