dqlk31541
dqlk31541
2018-12-05 00:42
浏览 30
已采纳

运行dev_appserver.py时,如何强制gcloud cli不监视某些目录?

I'm developing an app locally using Go and React with a project structure that looks somewhat like this:

/reactApp 
   /main.go
   /api 
   /reactUI 

While I am developing locally I am using the gcloud cli tool to run the Go code, and I'm using Node to run the UI. I need to handle CORS of course, but otherwise this works fairly well. The problem is there are too many files in the /reactUI directory for the gcloud cli tool to monitor them all. This means I need to manually start and stop the server every time I make a change to the Go source code.

The reactUI directory was created using the 'npx create-react-app' command. Since I'm running the react part of this app locally using node (and that handles file monitoring and auto-updating just fine), how can I get the gcloud tool to ignore the reactUI directory? Basically I just want the gcloud tool to monitor the API part of the app, and not the UI part. If I make a change to the API part of the app the gcloud local server should automatically recompile and restart.

I haven't found anything yet in the docs, please let me know if I missed something. Thanks!

图片转代码服务由CSDN问答提供 功能建议

我正在使用Go和React在本地开发应用程序,其项目结构如下所示:

  / reactApp 
 /main.go
 / api 
 / reactUI 
   
 
 

在本地开发时 我正在使用gcloud cli工具来运行Go代码,而我正在使用Node来运行UI。 我当然需要处理CORS,但否则效果会很好。 问题是/ reactUI目录中的文件太多,gcloud cli工具无法监视所有文件。 这意味着我每次对Go源代码进行更改时都需要手动启动和停止服务器。

reactUI目录是使用“ npx create-react-app”命令创建的。 由于我正在使用node在本地运行此应用程序的react部分(并且可以很好地处理文件监视和自动更新),因此如何获取gcloud工具来忽略reactUI目录? 基本上,我只希望gcloud工具监视应用程序的API部分,而不是UI部分。 如果我更改了应用程序的API部分,则gcloud本地服务器应自动重新编译并重新启动。

我还没有在文档中找到任何东西,如果我错过了什么,请告诉我。 谢谢!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dqce48404
    dqce48404 2018-12-05 22:38
    已采纳

    With https://issuetracker.google.com/issues/35895450 fixed the development server is supposed to not monitor changes in the files/directories matching the patterns specified in the skip_files section of the app/service's .yaml file.

    So you can try to add a skip_files section to the go app's .yaml file specifying the patterns for the files/directories you want ignored. Be careful to also add the default patterns (otherwise you'd lose them).

    点赞 评论

相关推荐