Using the Google App Engine Python API is there a way to access the name of the currently running application--i.e., the app name specified in your app.yaml
file with application: foobar
?
App Engine is a fully managed, serverless platform for developing and hosting web applications at scale. You can choose from several popular languages, libraries, and frameworks to develop your apps, and then let App Engine take care of provisioning servers and scaling your app instances based on demand.
NET applications, Google App Engine enables users to develop and host applications written using Java, Python and a new language called Go [25]. The platform also supports other languages that use JVM (Java Virtual Machine) runtime such as JRuby, JavaScript (Rhino), and Scala programming languages.
Python 3.10 is now generally available.
import os
appname = os.environ['APPLICATION_ID']
EDIT: I just noticed this because I got a new upvote on it today (shame on you, upvoter!), but this is no longer correct.
from google.appengine.api.app_identity import get_application_id
appname = get_application_id()
should be used. The value in os.environ
will include a "s~" prefix for applications using the HR datastore and, by default, "dev~" on the development server. (os.environ
should also be avoided entirely on App Engine anyway, since when concurrency support is added with the Python 2.7 runtime, use of os.environ
won't be threadsafe and will allow data to leak from one request to another, although obviously the application ID itself would be the same for multiple requests to the same application at the same time...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With