So, using a Flask hello world...
from flask import Flask
from jinja2 import Environment, FileSystemLoader
import os
app = Flask(__name__)
site_globals = {'site_title':'Shakna Israel'}
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
j2_env = Environment(loader=FileSystemLoader(THIS_DIR), trim_blocks=True)
@app.route("/")
def hello():
locals = {}
render_data = site_globals.copy()
render_data.update(locals)
return j2_env.get_template('index.html').render(render_data)
if __name__ == "__main__":
app.run()
<html>
<head>
<title>{{ site_title }}</title>
</head>
<body>
Hello World.
</body>
</html>
{
"production": {
"s3_bucket": "shaknaisrael",
"app_function": "shaknaisrael.app",
"delete_zip": true,
"debug": true
}
}
The intial deploy went absolutely fine, worked great. Then I tried to add the template stuff, so I can build a reasonably sized site.
1459875734099] No module named shaknaisrael
[1459875734099] local variable 'app_module' referenced before assignment: UnboundLocalError
Traceback (most recent call last):
File "/var/task/handler.py", line 161, in lambda_handler
return LambdaHandler.lambda_handler(event, context)
File "/var/task/handler.py", line 55, in lambda_handler
return cls().handler(event, context)
File "/var/task/handler.py", line 150, in handler
debug = bool(getattr(app_module, settings.DEBUG, True))
UnboundLocalError: local variable 'app_module' referenced before assignment