Question

Can WeasyPrint be used with the App Platform?

I’m looking into hosting my Python/Django application on the App Platform and I was wondering if WeasyPrint is supported? It seems to require some further installation besides the Python Package installation.

Any experiences or alternative recommendations to create PDF’s with Django? Thanks!


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Greg M
DigitalOcean Employee
DigitalOcean Employee badge
December 16, 2022

Hello! WeasyPrint can certainly be used with App Platform. I tried to create an instance with a clone of WeasyPrint, however, I wasn’t able to detect the service component.

One simple way to get around that however is to use a docker file.

I found one here: https://gitlab.com/jamesvl/weasyprint-docker-alpine

I created an app with the following app spec:

alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
name: shark-app
region: nyc
services:
- dockerfile_path: Dockerfile
  gitlab:
    branch: master
    repo: <your gitlab>/weasyprint-docker-alpine
  http_port: 5001
  instance_count: 1
  instance_size_slug: basic-xxs
  name: weasyprint
  routes:
  - path: /
alexdo
Site Moderator
Site Moderator badge
December 16, 2022

Hello @al3xs

Looking at the official documentation it shouldn’t be e problem to deploy WeasyPrint on the App Platform.

https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#linux

You can try using Dockerfile:

https://www.digitalocean.com/community/tutorials/docker-explained-how-to-containerize-python-web-applications

Regards

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel