{"id":23991297,"url":"https://github.com/loglux/djangotemplateconverter","last_synced_at":"2026-05-06T04:32:47.680Z","repository":{"id":250225897,"uuid":"833851587","full_name":"loglux/DjangoTemplateConverter","owner":"loglux","description":"DjangoTemplateConverter is a tool for converting HTML templates into Django templtes. It finds and copies static files (CSS, JS, images) and creates Django templates from HTML sections marked by comments.","archived":false,"fork":false,"pushed_at":"2024-08-02T12:56:38.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-14T23:05:13.833Z","etag":null,"topics":["bootstrap5","conver","django","hmtl-css","html-templates","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loglux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-25T22:31:26.000Z","updated_at":"2024-08-02T12:59:00.000Z","dependencies_parsed_at":"2025-01-07T19:39:05.613Z","dependency_job_id":null,"html_url":"https://github.com/loglux/DjangoTemplateConverter","commit_stats":null,"previous_names":["loglux/djangotemplateconverter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/loglux/DjangoTemplateConverter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglux%2FDjangoTemplateConverter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglux%2FDjangoTemplateConverter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglux%2FDjangoTemplateConverter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglux%2FDjangoTemplateConverter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loglux","download_url":"https://codeload.github.com/loglux/DjangoTemplateConverter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loglux%2FDjangoTemplateConverter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32678613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T02:33:58.958Z","status":"ssl_error","status_checked_at":"2026-05-06T02:33:39.611Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap5","conver","django","hmtl-css","html-templates","python"],"created_at":"2025-01-07T19:39:02.898Z","updated_at":"2026-05-06T04:32:47.661Z","avatar_url":"https://github.com/loglux.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Template Converter\n\n## Description\n\n`DjangoTemplateConverter` is a tool for converting HTML templates into Django templates. It finds and copies static files (CSS, JS, images) and creates Django templates from HTML sections marked by comments. Comments should start with the keyword `Start` and end with the keyword `End`. An important condition is that section names should be a single word (e.g., `AboutUs Start` instead of `About Us Start`).\n\n## Features\n\n- **Static Files Copy**: Copies all CSS, JS, and image files to the Django static folder.\n- **Template Creation**: Creates separate Django templates for each section and forms a main base template `base.html`.\n- **Navbar Link Update**: Updates links in the navbar to use Django's `{% url %}` template tag.\n- **URLs Configuration**: Automatically generates a `urls.py` file based on the sections identified in the HTML.\n- **Views Creation**: Creates a `views.py` file with a view function for each section.\n- **Additional HTML File Processing**: Processes additional HTML files in the index directory, converting them into Django templates. Note that the method does not remove duplicate sections like the navbar or footer. These should be manually consolidated to prevent duplication in the final Django application.\n\n## Installation and Usage\n\n### Dependencies\n\nMake sure you have the following dependencies installed:\n- Python 3.10+\n- BeautifulSoup4\n- urllib3\n\n### Installation\n\n1. Clone the repository:\n\n   ```sh\n   git clone https://github.com/loglux/DjangoTemplateConverter.git\n   ```\n\n2. Navigate to the project directory:\n\n   ```sh\n   cd DjangoTemplateConverter\n   ```\n\n3. Install the dependencies:\n\n   ```sh\n   pip install BeuatifulSoup4\n   ```\n\n### Usage\n\n1. Create an HTML file with sections marked by comments. For example:\n   ```html\n   \u003c!-- Header Start --\u003e\n   \u003cdiv\u003eHeader Content\u003c/div\u003e\n   \u003c!-- Header End --\u003e\n   \u003c!-- Footer Start --\u003e\n   \u003cdiv\u003eFooter Content\u003c/div\u003e\n   \u003c!-- Footer End --\u003e\n   ```\nIt is recommended to combine the header and navbar into the same template called navbar, enclosing the necessary parts of the header and navbar within the same comments:\n```html\n\u003c!-- Navbar Start --\u003e\n\u003cdiv\u003eHeader Content\u003c/div\u003e\n\u003cdiv\u003eNavbar Content\u003c/div\u003e\n\u003c!-- Navbar End --\u003e\n```\n\n2. Run the script `django_template.py` by specifying the Django app name and the path to your HTML file:\n   ```sh\n   python django_template.py\n   ```\n\n### Example Usage\n\nExample usage of the class:\n```python\nif __name__ == '__main__':\n    app_name = 'portfolio'\n    index_file = 'CryptoCoin-1.0.0/index.html'\n    converter = TemplateConverter(app_name, index_file)\n    converter.run()\n```\n\n## License\n\nThis project is licensed under the MIT licence.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floglux%2Fdjangotemplateconverter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floglux%2Fdjangotemplateconverter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floglux%2Fdjangotemplateconverter/lists"}