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

前端之家收集整理的这篇文章主要介绍了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 %*

猜你在找的Windows相关文章