I have the following setup of my Flask application:
├── app
│ ├── __init__.py
│ └── routes.py
├── application.py
└── zappa_settings.json
application.py
:
import os
from app import config_app
if __name__ == "__main__":
application = config_app(os.environ, __name__)
application.run(threaded=True)
app/__init__.py
:
from flask import Flask
def config_app(config, name=__name__):
app = Flask(__name__)
app.config.from_mapping(config)
...
return app
Now I'm trying to deploy the application with zappa
to AWS. When running zappa init
it prompts for an app_function
, however I'm not entirely sure what to set it to. So far I've tried
"app_function": "application.application"
Which returns a 502
error at the end.
Running zappa tail
:
Traceback (most recent call last):
File "/var/task/handler.py", line 567, in lambda_handler
return LambdaHandler.lambda_handler(event, context)
File "/var/task/handler.py", line 237, in lambda_handler
handler = cls()
File "/var/task/handler.py", line 132, in __init__
wsgi_app_function = getattr(self.app_module, self.settings.APP_FUNCTION)
AttributeError: module 'application' has no attribute 'application'