-
-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serverless + AWSLambda + WeasyPrint #952
Comments
Thank you for sharing this! As I don't use AWS at all, it's hard for me to write the documentation out of this information. Could you please write a paragraph that I could include in the install page? |
Is there a place(or repository) where we could put the lib.zip (libcairo) file so it stays like the @Prasengupta repo? This way we could put the links in the documentation too. |
I'll create a repo for that with an example of how to use it. Since I used lambci to build it there are a couple of packages that are not necessary in the zip file. |
I will welcome to do that and let me know where I can help. And as per the request, I would like to post the repo fo supporting weasy print in AWS lambda for python 3. |
@liZe Here is something that you can put on the install page. To use WeasyPrint with AWS Lambda or Serverless you need to user Layers. If you're using Serverless: 1 - I deploy de application on AWS. If you're using only AWS Lambda: The zip files for the layers can be found here: 2 - Download the zip from this repo and add as a layer too |
We’ll continue discussion in #1003. |
I'm posting this in order to help others to whom might have the same problem.
I'm using Serverless and Flask, with Weasyprint. Once deploy on AWS, the problem importing WeasyPrint happens.
So here is how I solved the problem:
1 - I deploy de application on AWS.
2 - Go to API Gateway and select your application
3 - Click in Layers and add 2 layers, one with weasyprint and another with libcairo. (zip files below)
4 - Save it and your application will run
The zip files that I used:
I try to use this one from @nelsonsar but it was too big for my application. Then I used this one from @Prasengupta which is only 18MB.
So, wrapping up, I used the lib.zip from @nelsonsar and the weasyprint_for_lambdat from @Prasengupta.
When using serverless, you can configure the deploy to use the layers you created on AWS setting up on settings.yml.
The text was updated successfully, but these errors were encountered: