Skip to main content

Djangify

A Python script that converts HTML Files / Templates to Django compatible HTML Templates.

Usage Info

username@hostname $ ./djangify.py -h
usage: djangify.py [-h] [-d [BASE_DIRECTORY]] [-a [APP_NAME]] [f [f ...]]

Converts specified html files or all html files to django format within a
specified directory.

positional arguments:
  f                    provide file names to convert

optional arguments:
  -h, --help           show this help message and exit
  -d [BASE_DIRECTORY]  Provide base directory
  -a [APP_NAME]        provide django app name

Description

Converts all the HTML files specified in the files (' f ') argument into Django templates, replacing the contents of 'src', 'href' and 'url' tags with their Django compatible static conterparts with their Django App name prefixed.

For Example:

To process a set of HTML files, copy the djangify.py script to the directory containing these HTML files, and run the following command, (Here 'blog' refers to the App name for which we are processing these files)

$ ./djangify.py -a blog

This command will replace all local files referenced in 'src', 'href' and 'url' tags in the following way :

Original :

    <img class="mySlides" src="res/landreg/1.jpg" style="width:100%">
    <li><a href="register.html">Register</a></li>

After script execution :

   <img class="mySlides" src=" {% static 'blog/res/landreg/1.jpg' %} " style="width:100%">
   <li><a href=" {% static 'blog/register.html' %} ">Register</a></li>

Metadata

Release files for djangify 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangify 1.0.0
File Size Uploaded
djangify-1.0.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djangify 1.0.0
File Interpreter ABI Platform
djangify-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / djangify-1.0.0.tar.gz

Download URL djangify-1.0.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3bad342abe75fbcab2ad332cbfc16de8baecb2e28f59223e4ffaed9a877d41b0
BLAKE2b-256 checksum
How to use checksums
0d1d85dada639dc42f128efac992e49ca9182015164ad9a96b16ec500b33d762
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10

Release files / djangify-1.0.0-py3-none-any.whl

Download URL djangify-1.0.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25f8d17c07f044c44588c2fc374eff0985c0dac027abf546856c4997f25ef750
BLAKE2b-256 checksum
How to use checksums
4368bace5b684e5ae79eea98142c8f3352ebef3d4ac778e858da156802074b62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page