.. _getting-started_django: Integration with Django ======================= 1 - Setup --------- 1 - Install with pip :: pip install snowebsvg 2 - Add ``snowebsvg`` to django apps installed : :: INSTALLED_APPS = [ ... 'snowebsvg', ] 3 - Run migrations :: python manage.py migrate 4 - Build SVG :: python manage.py svg_build Now, you have the list of available svg in your database. 2 - Add CSS files ----------------- There are 2 different methods to configure CSS files with Django : - You can add css files like the :doc:`HTML getting started `. - Or you can use django templatetags as below : :: {% load svg %} ... ... {% autoescape off %} {% svg_stylesheets 'themes' 'core' %} {% endautoescape %} The version of css files is determined based on the pypi package installed. You also need to configure :doc:`colors ` and :doc:`animations ` as needed. 3 - Add SVG in your Django HTML template ---------------------------------------- You can use ``svg_inline`` to include an SVG in your template with these parameters : - ```` : choose at `Snoweb SVG `_. - ```` : ``'light'`` or ``'dark'``, see more :doc:`here <../references/css>`. - ```` : ``100``, ``100%``, ``auto``, see more at `SVG width `_. - ```` : ``100``, ``100%``, ``auto``, see more at `SVG height `_. - ```` : ``'none'`` or ``'glass'``, see more :doc:`here <../references/settings>`. - ```` : ``True`` or ``False``, display a grid preview. - ```` : Add extra css classes to element. :: {% load svg %} {% svg_inline '' '' '' '' '' '' '' %}