AppEngine SDK for Go Bash Ubuntu Windows
AppEngine SDK for Go with Bash on Ubuntu on Windows
我正在 Bash Ubuntu Windows 中尝试使用 AppEngine SDK for Go,但出现错误。这是我的代码。
app.yaml
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
main.go
package main
import (
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/engine/standard"
)
func init() {
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
s := standard.New("")
s.SetHandler(e)
http.Handle("/", s)
}
这是错误和命令。
surface@DESKTOP-U7N4QNQ:~/projects$ goapp serve
INFO 2016-08-09 14:24:35,574 devappserver2.py:769] Skipping SDK update check.
INFO 2016-08-09 14:24:35,665 api_server.py:205] Starting API server at: http://localhost:38070
INFO 2016-08-09 14:24:35,670 api_server.py:648] Applying all pending transactions and saving the datastore
INFO 2016-08-09 14:24:35,671 api_server.py:651] Saving search indexes
Traceback (most recent call last):
File "/home/surface/dev/go_appengine/dev_appserver.py", line 89, in <module>
_run_file(__file__, globals())
File "/home/surface/dev/go_appengine/dev_appserver.py", line 85, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1040, in <module>
main()
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1033, in main
dev_server.start(options)
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 824, in start
self._dispatcher.start(options.api_host, apis.port, request_data)
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 194, in start
_module.start()
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/module.py", line 1180, in start
self._watcher.start()
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/inotify_file_watcher.py", line 220, in start
self._add_watch_for_path(directory)
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/inotify_file_watcher.py", line 205, in _add_watch_for_path
raise error
OSError: [Errno 22] EINVAL: '/home/surface/projects'
error while running dev_appserver.py: exit status 1
surface@DESKTOP-U7N4QNQ:~/projects$
我不知道如何解决这个问题。
我认为这是一个SDK的问题。
我自己得到答案。
此问题发生在 Windows 的 Ubuntu 的 Bash。
不支持文件观察器。 (已经有人发issue了https://github.com/Microsoft/BashOnWindows/issues/216)
因此,我使用 dev_appserver.py
和 --use_mtime_file_watcher=true
选项。
这是我完美运行的完整命令。
$ dev_appserver.py --use_mtime_file_watcher=true /home/surface/projects/
谢谢。
我正在 Bash Ubuntu Windows 中尝试使用 AppEngine SDK for Go,但出现错误。这是我的代码。
app.yaml
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
main.go
package main
import (
"net/http"
"github.com/labstack/echo"
"github.com/labstack/echo/engine/standard"
)
func init() {
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
s := standard.New("")
s.SetHandler(e)
http.Handle("/", s)
}
这是错误和命令。
surface@DESKTOP-U7N4QNQ:~/projects$ goapp serve
INFO 2016-08-09 14:24:35,574 devappserver2.py:769] Skipping SDK update check.
INFO 2016-08-09 14:24:35,665 api_server.py:205] Starting API server at: http://localhost:38070
INFO 2016-08-09 14:24:35,670 api_server.py:648] Applying all pending transactions and saving the datastore
INFO 2016-08-09 14:24:35,671 api_server.py:651] Saving search indexes
Traceback (most recent call last):
File "/home/surface/dev/go_appengine/dev_appserver.py", line 89, in <module>
_run_file(__file__, globals())
File "/home/surface/dev/go_appengine/dev_appserver.py", line 85, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1040, in <module>
main()
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1033, in main
dev_server.start(options)
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 824, in start
self._dispatcher.start(options.api_host, apis.port, request_data)
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 194, in start
_module.start()
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/module.py", line 1180, in start
self._watcher.start()
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/inotify_file_watcher.py", line 220, in start
self._add_watch_for_path(directory)
File "/home/surface/dev/go_appengine/google/appengine/tools/devappserver2/inotify_file_watcher.py", line 205, in _add_watch_for_path
raise error
OSError: [Errno 22] EINVAL: '/home/surface/projects'
error while running dev_appserver.py: exit status 1
surface@DESKTOP-U7N4QNQ:~/projects$
我不知道如何解决这个问题。 我认为这是一个SDK的问题。
我自己得到答案。
此问题发生在 Windows 的 Ubuntu 的 Bash。
不支持文件观察器。 (已经有人发issue了https://github.com/Microsoft/BashOnWindows/issues/216)
因此,我使用 dev_appserver.py
和 --use_mtime_file_watcher=true
选项。
这是我完美运行的完整命令。
$ dev_appserver.py --use_mtime_file_watcher=true /home/surface/projects/
谢谢。