Getting ready

WeasyPrint depends on several libraries that you need to install on your computer. On macOS, you can install them with Homebrew using this command:

$ brew install python3 cairo pango gdk-pixbuf libffi

Then, you can install WeasyPrint itself in the virtual environment of your project. Also, include it in requirements/_base.txt:

(env)$ pip install WeasyPrint==48

For other operating systems, check the installation instructions at https://weasyprint.readthedocs.io/en/latest/install.html.

Also, we'll be using django-qr-code to generate a QR code linking back to the website for quick access. Let's also install it in the virtual environment (and include it in requirements/_base.txt):

(env)$ pip install django-qr-code==1.0.0

Add "qr_code" to INSTALLED_APPS in the settings:

# myproject/settings/_base.py
INSTALLED_APPS = [

# Django apps…
"qr_code",
]
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.117.109