I am developing an App Engine App that uses memcache. Since there is only a single memcache shared among all versions of your app I am potentially sending bad data from a new version to the production version memcache. To prevent this, I think I may append the app version to the memcache key string to allow various versions of the app to keep their data separate.
I could do this manually, but I’d like to pull in the version from the app.yaml
How can I access the app version from within the python code?
The
os.environvariable contains a key calledCURRENT_VERSION_IDthat you can use. It’s value is composed of theversionfrom app.yaml concatenated together with a period and what I suspect is theapi_version. If I setversionto 42 it gives me the value of42.1. You should have no problems extracting the version number alone, but it might not be such a bad idea to keep theapi_versionaswell.EDIT:
@Nick Johnson has pointed out that the number to the right of the period is the minor version, a number which is incremented each time you deploy your code. On the development server this number is always 1.