我正在尝试在Windows上的Ubuntu的Bash上使用AppEngine SDK进行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上。
它不支持File Watcher。 (已经有人提出了一个问题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/
谢谢。