我刚刚尝试在Google App Engine上启动应用程序(https://github.com/mjibson/goread)。
我已经遵循了所有步骤,但是当我到达应该使用dev_appserver.py app.yaml
启动它的地步时,出现以下错误:
$ dev_appserver.py app.yaml
INFO 2013-11-27 17:14:13,250 sdk_update_checker.py:245] Checking for updates to the SDK.
INFO 2013-11-27 17:14:13,446 sdk_update_checker.py:273] The SDK is up to date.
WARNING 2013-11-27 17:14:13,455 api_server.py:331] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-11-27 17:14:13,460 api_server.py:138] Starting API server at: http://localhost:42131
INFO 2013-11-27 17:14:13,532 dispatcher.py:171] Starting module "default" running at: http://localhost:8080
INFO 2013-11-27 17:14:13,535 admin_server.py:117] Starting admin server at: http://localhost:8000
ERROR 2013-11-27 17:14:16,293 go_runtime.py:166] Failed to build Go application:
2013/11/27 17:14:16 go-app-builder: build timing: 10×6g (2.35416362s total), 18×gopack (104.629743ms total), 0×6l (0 total)
2013/11/27 17:14:16 go-app-builder: failed running 6g: signal: killed
(Executed command: /home/ubuntu/bin/go_appengine/goroot/bin/go-app-builder -app_base /home/ubuntu/mygo/src/github.com/mjibson/goread -arch 6 -binary_name _go_app -dynamic -extra_import$
appengine_internal/init -goroot /home/ubuntu/bin/go_appengine/goroot -nobuild_files ^^$ -unsafe -work_dir /tmp/tmpJex0GQappengine-go-bin -gcflags -I,/home/ubuntu/bin/go_appengine/goroo
t/pkg/linux_amd64_appengine -ldflags -L,/home/ubuntu/bin/go_appengine/goroot/pkg/linux_amd64_appengine -gopath /home/ubuntu/mygo sanitizer/sanitize.go rdf/rdf.go rss/rss.go types.go fun
cs.go utils.go settings.go atom/atom.go sanitizer/strip.go main.go admin.go charge.go user.go autodiscover.go sanitizer/snip.go tasks.go)
^CINFO 2013-11-27 17:14:18,348 shutdown.py:44] Shutting down.
INFO 2013-11-27 17:14:18,375 api_server.py:524] Applying all pending transactions and saving the datastore
INFO 2013-11-27 17:14:18,375 api_server.py:527] Saving search indexes
使用sudo只能更改错误部分:
引起问题的线路:
包装 sanitizer
17 package sanitizer
18
19 import (
20 "bytes"
21 "code.google.com/p/go.net/html"
22 "io"
23 "net/url"
24 "strings"
25 )
这是我的环境:
$ goapp env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ubuntu/mygo"
GORACE=""
GOROOT="/home/ubuntu/bin/go_appengine/goroot"
GOTOOLDIR="/home/ubuntu/bin/go_appengine/goroot/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CGO_ENABLED="1"
$ ll ~/bin/
Nov 27 14:34 appcfg.py -> go_appengine/appcfg.py*
Nov 27 14:34 dev_appserver.py -> go_appengine/dev_appserver.py*
Nov 18 01:36 go_appengine/
Nov 27 14:35 goapp -> go_appengine/goapp*
/home/ubuntu/mygo/pkg/
└── linux_amd64_appengine
└── code.google.com
└── p
└── go.net
├── html
│ └── atom.a
└── html.a
/home/ubuntu/mygo/src/
├── code.google.com
│ └── p
│ ├── go-charset
│ │ ├── charset
│ │ ├── cmd
│ │ ├── data
│ │ ├── datafiles
│ │ └── lib
│ └── go.net
│ ├── dict
│ ├── html
│ ├── idna
│ ├── ipv4
│ ├── ipv6
│ ├── netutil
│ ├── proxy
│ ├── publicsuffix
│ ├── spdy
│ └── websocket
└── github.com
├── gorilla
│ ├── context
│ └── mux
├── MiniProfiler
│ └── go
│ ├── example
│ ├── miniprofiler
│ ├── miniprofiler_gae
│ ├── miniprofiler_revel
│ ├── redis
│ ├── sql
│ └── ui
└── mjibson
├── appstats
│ └── static
├── goon
└── goread
├── atom
├── rdf
├── rss
├── sanitizer
├── static
└── templates
App Engine版本:
linux_amd64-1.8.8
编辑
Now I am getting
ERROR 2013-11-28 02:11:38,201 go_runtime.py:166] Failed to build Go application: /home/ubuntu/mygo/src/github.com/MiniProfiler/go/miniprofiler/static.go:19263: out of memory
尽管在运行此命令时我的机器上有480M的可用RAM。
编辑
我已经测试过,似乎机器上没有足够的RAM可以在其上运行(免费Amazon实例),因为它在本地机器上运行顺利,并带有以下
htop
摘要 VIRT RES SHR S CPU% MEM% TIME+ Command
1492M 88588 5804 S 0.0 1.5 0:14.72 python /home/XXXX/bin/dev_appserver.py app.yaml
最佳答案
我已经测试过,似乎机器上没有足够的RAM来运行(免费Amazon实例),因为它可以在具有6 GB RAM的本地机器上平稳运行。
关于python - 无法构建Go应用程序: … : can't find import: "code. google.com/p/go.net/html,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20247599/