I am trying to pass some configuration variables to my main.py from app.yaml. I haven't been able to locate the syntax for accessing app.yaml from the code.
For example you want to have the user put their client number in app.yaml and access it from main.py to pass into main.html. While it would be easy to create a variable in main.py to pass it, it seems to be something that would be better put into app.yaml.
Example:
app.yaml
application: xyz
version: 1
runtime: python27
...
clientID: (ID here)
main.py
myID = appYAML.clientID
...
values = {'xyz': blah.blah, 'myID': myID }
main.html
...
<script>
...
{% ifequal myID %}
my_client = {{myID}}
...
</script>
With the 1.6.5 release, App Engine support this[1]:
- In your app.yaml file, you can include an env_variables stanza that will set
the given environment variables in your application's runtime.
Information on how to use this is available at: https://cloud.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Defining_environment_variables.
That's not supported, and you should put your application-specific settings into your own YAML file.
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