简体   繁体   中英

AppEngine SDK for Go with Bash on Ubuntu on Windows

I am trying to use AppEngine SDK for Go in Bash on Ubuntu on Windows, but I have an error. Here is my code.

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)
}

and here is error and command.

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$

I do not have any idea to resolve this problem. I think this is a SDK's problem.

I got answer by myself.

This problem was happening in Bash on Ubuntu on Windows.

It does not support File Watcher. ( Already somebody made a issue https://github.com/Microsoft/BashOnWindows/issues/216 )

Therefore, I use dev_appserver.py and --use_mtime_file_watcher=true option.

Here is my full command that works perfectly.

$ dev_appserver.py --use_mtime_file_watcher=true /home/surface/projects/

Thank you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM