Comments (9)
That's fantastic, thanks for sharing! I look forward to experimenting with this myself.
WhiteNoise looks like it satisfies a number of requirements that I have, so once I try it out I hope to add it to the official Zappa documentation.
If you'd be so kind, I'd love it if you could see if it is obeying the caching headers like you say it should. If not, then perhaps there is something more that we could do to help with that.
from zappa.
Both of these are great suggestions and wouldn't be terrible to implement.
from zappa.
Thanks for the comment Shakna!
Excludes are already in place, but it looks like it wasn't documented. Fixing that now - but you just add the patterns to exclude in "exclude": [".tar.gz", ".pem"] or whatever. Adding to README now..
Pre build script is a good one, I've wanted that as well. Can you describe your use case for that?
from zappa.
Okay, there is now support for a "prebuild_script" setting in the latest master.
from zappa.
@Miserlou Awesome. (For me, the prebuild was mostly minifying css, precompiling CoffeeScript and the like).
from zappa.
Ah, that makes total sense.
How are you serving up your static assets? YESTERDAY, API Gateway finally got the feature we need to serve binary data through it, but it's not a great practice and you should really use a CDN or something like that.
from zappa.
Whitenoise, but I only use it for text assets, like CSS and JS.
from zappa.
Oh wow, now that's really interesting! I've never seen that before.
Describing how to best handle static files is still an open and pressing matter for Zappa, so I'd love to know more about your setup!
If you don't mind, can you describe your setup in a bit more details? For example, are you using Django or Flask? Have you put Whitenoise on Lambda, or is that running on a dedicated machine somewhere?
from zappa.
Sure thing.
I'm using Flask for now, and wrapping it with Whitenoise before hitting it on Lambda.
So, the application that Zappa serves looks like:
import whitenoise
import routing
flaskApp = routing.app
app = whitenoise.WhiteNoise(flaskApp, root='/static')
I then have CloudFlare acting as a CDN around the site.
Since the only images I've used thus far are SVGs, and CSS shapes, I don't need to worry about binary formats and being served the wrong way.
That being said, Whitenoise should be enough to do it, if behind a CDN. So long as a user is using a CDN, then how they serve their files should be easy and simple, and fast.
That being said, I'm still getting used to Lambda, and haven't inspected to see if it obeys caching headers properly, or, like S3, completely fails to use gzip or the like.
from zappa.
Related Issues (20)
- Decorating a event function may cause unexpected errors
- AWS CodeBuild Error
- Zappa not compatible with Python3.8 HOT 1
- Zappa template object has no attribute add_description error, cfn_flip dependency HOT 4
- Zappa Deploy | Update error on "No such file or directory" Possible duplicate of https://github.com/Miserlou/Zappa/issues/1232 HOT 2
- AttributeError: 'Template' object has no attribute 'add_description' HOT 8
- I've found a bit more elegant solution to the GeoDjango problem. Good news: it doesn't rely on the configurable directory hackish-ness, but still (as of September 19th, 2019) relies on a separate fork of Zappa.
- Lambda functions with s3 event sources are publically accessible HOT 1
- [Question] Is there a way to set the API Gateway stage on AWS different from the 'stage name' in the config?
- Regarding Lambda Packages
- Zappa Update Dev raised an AccessDeniedError
- ImportError: cannot import name 'Flask' from 'flask' (unknown location) HOT 2
- Package size over limit
- zappa deploy issue using python 3.8 instead of python 3.7 HOT 2
- added support for Django websockets/channels/asgi HOT 1
- Cannot find libxmlsec1.so.1 in AWS Lambda python3.8 environment HOT 2
- keep_warm callbacks have no effect on warmup HOT 1
- Unable to deploy Zappa to AWS Lambda return 502 everytime HOT 1
- S3 bucket is not reused with `slim_handler: True` HOT 5
- extra_permissions not updating HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zappa.