Retrieving YAML parameters at run time in App Engine (Python)

Is it possible to programmatically get any of the YAML parameters at runtime? Are they stored somewhere in the environment?

A good example would be to automatically detect the version of the application and add it as a comment on the landing HTML page.

+3
source share
3 answers

No, but some data is available from os.environ - for example, os.environ['APPLICATION_ID']and os.environ['CURRENT_VERSION_ID'].

+5
source

( , CGI WSGI). app.yaml , app.yaml (, my.yaml )

import yaml

...

data = yaml.load(open('my.yaml', 'rb'))

data.

+4

In PyYAML, the file __init__.pyin the yaml folder has a global variable __version__, so

#import yaml
print yaml.__version__
+2
source

Source: https://habr.com/ru/post/1767719/


All Articles