From dd5d1f341c9ee74c62035a1d11893d7f1a819e13 Mon Sep 17 00:00:00 2001 From: javulticat Date: Wed, 8 Nov 2023 23:52:33 -0500 Subject: [PATCH] Improve bad code example in README (#1281) * Fix bad code example in README * Ran doctoc * doctoc thinks bare comments within code blocks must belong in TOC - used inline comment as workaround --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6756d0b7a..d386b6fef 100644 --- a/README.md +++ b/README.md @@ -1196,14 +1196,13 @@ If you want to use native AWS Lambda environment variables you can use the `aws_ During development, you can add your Zappa defined variables to your locally running app by, for example, using the below (for Django, to manage.py). ```python -if 'SERVERTYPE' in os.environ and os.environ['SERVERTYPE'] == 'AWS Lambda': - import json - import os +import json +import os + +if os.environ.get('AWS_LAMBDA_FUNCTION_NAME') is None: # Ensures app is NOT running on Lambda json_data = open('zappa_settings.json') env_vars = json.load(json_data)['dev']['environment_variables'] - for key, val in env_vars.items(): - os.environ[key] = val - + os.environ.update(env_vars) ``` #### Remote Environment Variables