Context
I have a local folder containing multiple Python Flask applications and a commons python package. As you can see I have created a virtualenv for each of the Flask applications, because I would like to deploy to AWS Lambda using Zappa and want to include only the relevant dependencies in the package zip that goes to AWS.
project_folder/
+-- commons/
| +-- __init__.py
| +-- setup.py
| +-- module1.py
+-- application1/
| +-- __init__.py
| +-- app.py
| +-- env/
+-- application2/
| +-- __init__.py
| +-- app.py
| +-- env/
Problem
I am not able to include the commons package in the Flask applications. I assume this has to do because it is collateral and not a subdirectory.
Question
How can I make sure the commons package is included when I call zappa deploy from inside project_folder/application1/?
One of the solutions is to install the package in your virtual environment (pip install . in the commons directory). Zappa would use all the packages that are installed in it.
Of course, this is a bit cumbersome because you'd need to re-install the package every time you modify it. You can either:
zappa deploy.callbacks section of zappa_settings.json. This module would be called by the deployment/update process and could theoretically re-install the package beforehand. However, this is option is just my guess that it might be possible. I've never tried anything like that.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