2

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???

Sam Holder
  • 32,535
  • 13
  • 101
  • 181
user578542
  • 113
  • 4
  • 12

1 Answers1

0

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.

Shay Erlichmen
  • 31,691
  • 7
  • 68
  • 87
  • Thank u very much, I don't know how to write handler for app enigne code can u give me the documentions or example – user578542 Nov 17 '11 at 08:03
  • 2
    @user578542 If you don't know how to write a handler in App Engine, you don't know how to write an App Engine app at all, and you should start with the [getting started guide](http://code.google.com/appengine/docs/python/gettingstartedpython27/). – Nick Johnson Nov 17 '11 at 08:53
  • @NickJohnson Thanks for ur suggestion i will start today. – user578542 Nov 17 '11 at 10:44