dp0518 2015-08-16 21:46
浏览 75
已采纳

在OSX上重新启动后,本地GAE数据存储区为空

I'm building a Google App Engine application with a Go backend + Polymer frontend. As a result, I'm using a dispatch.yaml file to serve both at the same time.

The problem I'm facing is that the datastore is empty when I restart my computer. I've tested this on both OSX 10.9.5 and 10.10.4. Both exhibit the same response upon a system reboot. Windows 7, however, seems to hold on to the data.

The documentation suggests that data should persist, since I'm not explicitly calling a clear. It's not. I've tried to set the datastore location myself using this:

dev_appserver.py --datastore_path=~/go_apps/data ~/go_apps/my_app

I'm receiving this error:

google.appengine.tools.devappserver2.errors.AppConfigNotFoundError: "/Users/anthony/go_apps/my_app is a directory but does not contain app.yaml or app.yml

Obviously, since I'm using a dispatch.yaml file, it wouldn't. So, since the backend, which handles the data, does have an app.yaml file, I try to set it there. I use this command:

dev_appserver.py --datastore_path=~/go_apps/data ~/go_apps/my_app/backend

That doesn't seem to work either, as I get this error:

sqlite3.OperationalError: unable to open database file

Okay? Well, not sure where to turn now. From what I could gather from other posts, that data is stored temporarily. But, I can't seem to set a custom, non-temporary location for the data. So, now I'm populating a datastore every time I reboot, which seems ridiculous.

* Edit *

I've tried the following, which seems like it tries to launch the app, and creates a datastore.db file at the correct location:

dev_appserver.py --datastore_path ~/go_apps/my_app/data/datastore.db  ~/go_apps/my_app/dispatch.yaml ~/go_apps/my_app/backend/app.yaml ~/go_apps/my_app/frontend/app.yaml

However, I'm getting a weird error now:

/var/folders/04/3hxnpxc15wj2k4v40lkdncd00000gn/T/tmpkcQYnFappengine-go-bin/backend.go:13: can't find import: "github.com/gorilla/mux"

Does Go build to that folder temporarily? That import is definitely available, and always builds fine calling goapp serve.

Here is what my imports look like on backend.go

import (
    //standard library
    "fmt"
    "net/http"
    "time"
    "log"

    //third party
    "github.com/gorilla/mux"
    "github.com/gorilla/securecookie"
    "github.com/dgrijalva/jwt-go"
    "golang.org/x/crypto/bcrypt"

    //my imports
    "github.com/section14/go_polymer_comm_pkg/controller"
)
  • 写回答

2条回答 默认 最新

  • duanbi5906 2015-08-18 02:22
    关注

    Got it up and running by adding both GOPATH and GOROOT environment variables to my .bash_profile. In total, these three paths (first path was already set) are needed for it to run:

    # Add Google AppEngine path
    export PATH=/Users/anthony/go_appengine:$PATH
    
    # GOPATH
    export GOPATH=/Users/anthony/go_appengine/gopath
    export PATH=$PATH:$GOPATH
    
    # GOROOT
    export GOROOT=/Users/anthony/go_appengine/goroot
    export PATH=$PATH:$GOROOT
    

    This command is called from inside the project folder (mine resides outside of the appengine folder) for it to launch:

    dev_appserver.py --datastore_path data/datastore.db  dispatch.yaml backend/app.yaml frontend/app.yaml
    

    Notice that the .yaml files are still there. It builds fine with them, and probably builds fine without them if you don't need a dispatch.yaml file.

    Thanks @icza for the direction. Wanted to organize the steps in a post for easier reading.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里