Two Ways to Handle Django Static Files
A brief overview of two solutions
The Django project has some strategies for deploying static files but in AWS Lambda, we have very different considerations. There are two common options.
Option 1 - serve static files from your Zappa project#
You can configure your app to serve static files using the package WhiteNoise. This enables your Django application not only to execute your Django views, but also deliver these static files when requested. This is normally not done by Django, because the web server (like Apache or NGINX) does this job. But since there is no web server we can configure, this package was created.
The advantages of this option are that your app has fewer dependencies. It doesn't rely on other AWS services or tools. It's also nice since usually your static files are tightly coupled with your application.
Additionally, WhiteNoise does a good job of compressing files before sending them to the web client. This speeds up the delivery of important assets and makes the web pages render faster.
The big downside of this approach is that you will be charged by AWS for using Lambda CPU cycles to serve up files that could be delivered much cheaper. For example, if you take a million downloads of your CSS file, an AWS S3 service can do that much cheaper than AWS Lambda.