Jos*_*Fox 3 google-app-engine google-cloud-datastore gcloud
我运行 Datastore 模拟器,并得到以下显然正确的控制台日志
> gcloud beta emulators datastore start --project=myproj --data-dir "./gcloud_datastore"
[datastore] If you are using a library that supports the DATASTORE_EMULATOR_HOST environment variable, run:
[datastore]
[datastore] export DATASTORE_EMULATOR_HOST=localhost:8232
[datastore]
[datastore] Dev App Server is now running.
Run Code Online (Sandbox Code Playgroud)
在另一个 cmd 窗口中,当模拟器正在运行时,我运行以下命令,或者我先停止模拟器。无论哪种方式,它都会产生不同的端口和不同的项目:
> gcloud beta emulators datastore env-init
set DATASTORE_DATASET=anotherproj
set DATASTORE_EMULATOR_HOST=localhost:8297
set DATASTORE_EMULATOR_HOST_PATH=localhost:8297/datastore
set DATASTORE_HOST=http://localhost:8297
set DATASTORE_PROJECT_ID=anotherproj
Run Code Online (Sandbox Code Playgroud)
出了什么问题?我该如何解决?
小智 6
运行env-init
命令时使用相同的数据目录。例如:
gcloud beta emulators datastore env-init --data-dir=./gcloud_datastore
Run Code Online (Sandbox Code Playgroud)
当您使用该start
命令启动模拟器时,它会env.yaml
在指定的数据目录中创建/更新一个文件。该文件包含环境信息(例如端口、项目名称),我相信env-init
命令会使用这些信息。
归档时间: |
|
查看次数: |
1234 次 |
最近记录: |