LoginSignup
1
0

More than 1 year has passed since last update.

WindowsでDjango + WeasyPrintの環境構築する

Last updated at Posted at 2021-06-07

はじめに

mac、EC2上でDjango + WeasyPrintの環境を動かしてたのですが、今回Windows10上で開発環境を構築することになったのでメモとして残します。

そのときの環境

  • Python 3.8.2
  • Django 2.2.11
  • WeasyPrint 52.5
  • gtk3-runtime-3.24.29-2021-04-29-ts-win64.exe

WeasyPrintとは

PDF および PNG にエクスポートできる HTML および CSS の視覚的なレンダリングエンジンです。これは、印刷用の Web 標準をサポートすることを目的としています。WeasyPrint は、BSDライセンスの下で利用可能なフリーソフトウェアです。

WeasyPrintを動かすための準備を行います。

> pip install --upgrade pip setuptools

WeasyPrintをインストールします。

> pip install WeasyPrint

GTK+ 64 Bit Installerをインストールします。

最新のこの gtk3-runtime-x.x.x-x-x-x-ts-win64.exe をダウンロードします。

ダウンロードしたらgtk3-runtime-x.x.x-x-x-x-ts-win64.exeを実行しインストールします。

WeasyPrintを実行します。

無事インストールできたら、WeasyPrintが実行できるか試します。ここでpdfが出来れば開発環境の構築は終わりです。

> weasyprint http://weasyprint.org weasyprint.pdf

コマンドを実行したカレントフォルダにweasyprint.pdfが作成されます。

それでは、DjangoでEnjoyしましょう!!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0