每当我将项目上传到应用程序引擎服务器时运行一些代码
我已经构建了一个 apeninge 项目,因此,如何在应用程序服务器上仅运行一次代码,即当我将整个项目上传到服务器时。
我该如何完成这个任务???
I've built an appeninge project so, how can I run some piece of code on the appserver only once, i.e when ever I upload the whole project on to the server.
How should I achieve this task???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然每次上传应用程序时它都会获得一个唯一的版本号 {app version.(some unique number)},但没有一种官方方法可以发现您的应用程序是否已被修改,但由于没有文档 API 来说明如何修改得到它我不会冒险并使用它。
您需要做的是有一个脚本来上传您的应用程序,当脚本完成后,您可以调用应用程序中的处理程序,该处理程序在数据存储中设置一个值,将应用程序标记为新应用程序。
一旦获得,您可以在处理程序的数据存储中查找它,如果找到它就运行代码。
There isn't an official way to discover if your application has been modified altought each time you upload your application it gets a unique version number {app version.(some unique number)} but since there isn't a document API on how to get it I wound't take a risk and use it.
What you need todo is to have a script that will upload your application and when the script is done you can call a handler in your application that set a value in the datastore that marks the application as new.
Once you have that, you can look for it in the datastore in your handlers and run the code if you find it.