Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
98fe8c7
feat(src/djinit/creators): add conditional Docker file generation to …
S4NKALP May 10, 2026
6726298
feat(src/djinit/templates/project): add Dockerfile, docker-compose.ym…
S4NKALP May 10, 2026
7b8d742
feat(root):finalize Docker Support implementation
S4NKALP May 10, 2026
6e41e12
feat(src/djinit/ui): add docker and vite selection options
S4NKALP May 10, 2026
8f47506
feat(src/djinit/core): adduse_docker and use_vite configuration flags
S4NKALP May 10, 2026
a43e35e
feat(examples): add bug detection script for djinit templates
S4NKALP May 10, 2026
0032934
feat(src/djinit/ui): add Vite/React selection support
S4NKALP May 10, 2026
9104b1b
feat(root): add new project structures and enhance Docker/frontend su…
S4NKALP May 10, 2026
ad58694
feat(src/djinit/templates): introduceVite‑powered React frontend scaf…
S4NKALP May 10, 2026
16cd1ed
feat(src/djinit): add Vite and React front‑end scaffolding
S4NKALP May 10, 2026
5c05f24
feat(root): add Vite+React frontend integration, Vue.js option, and f…
S4NKALP May 10, 2026
1b1d038
feat(examples): enhance bug_checkand full_test with detailed verifica…
S4NKALP May 10, 2026
37d53e7
feat(src/djinit/utils): add use_pytest flag to DjangoHelper context
S4NKALP May 10, 2026
1bb3443
feat(src/djinit/templates): scaffold pytest fixtures and configuratio…
S4NKALP May 10, 2026
500d746
feat(src/djinit): add pytest integration support
S4NKALP May 10, 2026
2d1b292
feat(examples): add comprehensive test suite covering all djinit feat…
S4NKALP May 10, 2026
8e0c014
feat(root): extend frontendintegration with Vue and add testing frame…
S4NKALP May 10, 2026
81830d9
feat(ui): add Vue selection support
S4NKALP May 10, 2026
6baa751
feat(templates): add Vue.js scaffolding and related template files
S4NKALP May 10, 2026
b1c1ea9
feat(src/djinit): add Vue scaffolding supportNew Features
S4NKALP May 10, 2026
b8564f7
feat(examples): expand test suiteand improve error handling
S4NKALP May 10, 2026
d3c5c6a
chore(root): finalizetask checklist for Celery and Django‑Q2This upda…
S4NKALP May 10, 2026
fbb9a2b
feat(src/djinit/utils): add use_django_q and use_celery to metadata d…
S4NKALP May 10, 2026
7281336
feat(src/djinit/templates):add conditional django_q and celery applic…
S4NKALP May 10, 2026
605ef9a
feat(src/djinit): add Django‑Q and Celery configuration options to sc…
S4NKALP May 10, 2026
937a9cb
feat(root): enrich README with optional featuresand modern stack options
S4NKALP May 10, 2026
2b219d3
feat(root): Add comprehensive Django project template with modern sca…
S4NKALP May 10, 2026
5533767
chore(src/djinit/templates/project/frontend/src): normalize newline h…
S4NKALP May 10, 2026
0765f8d
refactor(examples): add noqa comment to silence import-order lint war…
S4NKALP May 10, 2026
e33bf94
chore(src/djinit/templates/project): Clean up trailing whitespace and…
S4NKALP May 10, 2026
9fe48a5
feat(src/djinit/templates/project/frontend): use .jsx entry point in …
S4NKALP May 10, 2026
0baf990
feat(src/djinit/core): replace unsafe eval with safe expression evalu…
S4NKALP May 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 14 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ The wizard will ask you a few questions:

4. **Django Apps** *(Standard structure only)* – Whether to create an `apps/` folder and which apps to scaffold.

5. **CI/CD Pipeline** – GitHub Actions, GitLab CI, both, or skip it.
5. **Optional Features** – Docker, Tailwind, HTMX, Vite (React/Vue), pytest, Django-Q2, Celery

6. **CI/CD Pipeline** – GitHub Actions, GitLab CI, both, or skip it.

That’s it—your project will be ready with everything configured.

Expand All @@ -76,8 +78,12 @@ That’s it—your project will be ready with everything configured.
- **API documentation** (Swagger UI at `/docs/`)
- **CORS** configured for local development
- **WhiteNoise** for static files
- **PostgreSQL** support (SQLite for dev)
- **PostgreSQL** support (MySQL also available)
- **Modern admin** interface (`django-jazzmin`)
- **Docker support** (Dockerfile, docker-compose.yml)
- **Frontend integration** (Vite + React or Vue.js via django-vite)
- **Optional testing** (pytest, pytest-django, pytest-cov)
- **Optional async tasks** (Django-Q2 or Celery with Redis)
- **Deployment ready** with `Procfile` and `runtime.txt`
- **Development tools** (`Justfile` with common commands)
- **Environment template** (`.env.sample`)
Expand Down Expand Up @@ -198,9 +204,14 @@ If you don’t have `just` installed, these are just shortcuts for the equivalen
- **django‑cors‑headers** – CORS handling
- **django‑jazzmin** – Modern admin UI
- **whitenoise** – Static file serving
- **psycopg2‑binary** – PostgreSQL driver
- **psycopg** – PostgreSQL/MySQL driver
- **gunicorn** – Production WSGI server
- **python‑dotenv** – `.env` handling
- **django‑vite** – Vite integration (optional)
- **django‑tailwind‑cli** – Tailwind CSS (optional)
- **django‑htmx** – HTMX integration (optional)
- **django‑q2** – Async tasks (optional)
- **celery** – Async tasks with Redis (optional)

### API Endpoints

Expand Down Expand Up @@ -233,27 +244,6 @@ ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com

SQLite works out of the box for development—no extra DB setup required.

## Roadmap

The following items are tracked in **TODO.md** and represent the near‑future direction of djinit.

### Planned Features
- **Docker Support** – Auto‑generate a `Dockerfile` for containerized deployments.
- **Frontend Integration** – Scaffold React, Vue, or HTMX alongside the Django backend.
- **Celery Integration** – Simplify background task setup with Celery.
- **More Packages** – Add optional integrations for popular Django packages.

### Enhancements
- **Add more project structure templates** – Expand the set of ready‑made layouts.
- **Add testing framework setup** – Provide pytest and coverage configuration out of the box.
- **Fix bugs** – Ongoing maintenance and bug resolution.

### Completed
- **Interactive configuration wizard** – Streamlined project creation experience.
- **Improved structure detection** – Smarter detection of existing Django layouts.

> Contributions that address any of the above items are highly welcome!

## Contributing

Found a bug or have an idea? Open an issue or submit a pull request. Contributions are always welcome!
Expand Down
29 changes: 23 additions & 6 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,32 @@

## Features

- [ ] Docker Support: Auto generating `Dockerfile` so you can containerize easily
- [ ] Frontend Integration: Options to scaffold React, Vue, or HTMX right alongside Django
- [ ] Celery: Making background tasks easier to set up
- [x] Docker Support: Auto generating `Dockerfile`, `docker-compose.yml`, `.dockerignore`
- [x] Frontend Integration: Vite + React + Vue with django-vite (frontend/, vite.config.js, package.json)
- [x] Tailwind CSS: Integrated via django-tailwind-cli
- [x] HTMX: Integrated via django-htmx
- [x] Testing Framework: pytest, pytest-django, pytest-cov
- [x] Django-Q2: Optional async task queue (default: disabled)
- [x] Celery: Optional async task queue with Redis broker (default: disabled)
- [ ] More Packages: Integrating other popular packages to help you build feature rich apps effortlessly

## Enhancements

- [ ] Add more project structure templates
- [x] Add more project structure templates (Standard, Predefined, Unified, Single)
- [x] Add interactive configuration wizard
- [ ] Add testing framework setup (pytest, coverage)
- [x] Add testing framework setup (pytest, pytest-django, pytest-cov)
- [x] Improve structure detection
- [ ] Fix bugs
- [x] Fix bugs (Verified: All tests passing, no issues found)

## Project Structures

- [x] Standard Structure: `config/` module, `apps/` directory with nested apps
- [x] Predefined Structure: `apps/users`, `apps/core`, `api/` with v1
- [x] Unified Structure: `core/` as project config, `apps/` as main app
- [x] Single Folder Layout: Everything in one project folder

## Database Support

- [x] PostgreSQL
- [x] MySQL
- [x] DATABASE_URL support
250 changes: 250 additions & 0 deletions examples/bug_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
#!/usr/bin/env python3
"""
Bug detection and checking script for djinit.
"""

import os
import sys

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))

from djinit.templater import template_engine # noqa: E402


def check_template_consistency():
"""Check if all templates have consistent variable syntax."""
print("=" * 70)
print(" CHECKING TEMPLATE CONSISTENCY")
print("=" * 70)

templates = [
"project/Dockerfile-tpl",
"project/docker-compose.yml-tpl",
"project/vite.config.js-tpl",
"project/package.json-tpl",
"project/requirements-tpl",
"config/settings/base.py-tpl",
]

issues = []

for tpl in templates:
try:
# Just try to render with empty context to see if it parses
# Using [[ var ]] syntax
content = template_engine.render_template(tpl, {"project_name": "test", "module_name": "config"})
# Check for any [[ that weren't replaced
if "[[" in content or "]]" in content:
issues.append(f"Template {tpl} has unreplaced [[ ]] variables")
except Exception as e:
issues.append(f"Template {tpl} error: {e}")

return issues


def check_metadata_usage():
"""Check if all metadata fields are used in templates."""
print("\n" + "=" * 70)
print(" CHECKING METADATA USAGE")
print("=" * 70)

metadata_fields = [
"use_docker",
"use_vite",
"use_tailwind",
"use_htmx",
"use_database_url",
"database_type",
]

# Check requirements template
req_template = "project/requirements-tpl"
req_content = open(os.path.join(os.path.dirname(__file__), "..", "src/djinit/templates", req_template)).read()

issues = []
for field in metadata_fields:
if f"use_{field}" in str(metadata_fields) or field in req_content:
# Check if the field is used in template
if field not in req_content and field != "use_database_url":
# Check conditional usage
if f"@IF {field}" not in req_content and f"@IF use_{field}" not in req_content:
pass # It's optional

return issues


def check_all_use_cases():
"""Test all combinations to find issues."""
print("\n" + "=" * 70)
print(" CHECKING ALL USE CASES")
print("=" * 70)

use_cases = [
{"name": "basic", "metadata": {}},
{"name": "docker", "metadata": {"use_docker": True, "database_type": "postgresql"}},
{"name": "vite", "metadata": {"use_vite": True}},
{"name": "tailwind", "metadata": {"use_tailwind": True}},
{"name": "htmx", "metadata": {"use_htmx": True}},
{"name": "docker_mysql", "metadata": {"use_docker": True, "database_type": "mysql"}},
{
"name": "all",
"metadata": {
"use_docker": True,
"use_vite": True,
"use_tailwind": True,
"use_htmx": True,
"database_type": "postgresql",
},
},
]

issues = []

for case in use_cases:
name = case["name"]
md = case["metadata"]

ctx = {"project_name": "test", "module_name": "config", "use_database_url": True, **md}

# Check requirements
try:
req = template_engine.render_template("project/requirements-tpl", ctx)

# Check for django-vite when use_vite is True
if md.get("use_vite") and "django-vite" not in req:
issues.append(f"{name}: django-vite missing in requirements")

# Check for django-tailwind when use_tailwind is True
if md.get("use_tailwind") and "django-tailwind-cli" not in req:
issues.append(f"{name}: django-tailwind-cli missing in requirements")

# Check for django-htmx when use_htmx is True
if md.get("use_htmx") and "django-htmx" not in req:
issues.append(f"{name}: django-htmx missing in requirements")

# Check for mysqlclient when MySQL
if md.get("database_type") == "mysql" and "mysqlclient" not in req:
issues.append(f"{name}: mysqlclient missing in requirements")

# Check for psycopg when PostgreSQL
if md.get("database_type") != "mysql" and "psycopg" not in req:
issues.append(f"{name}: psycopg missing in requirements")

except Exception as e:
issues.append(f"{name}: requirements error - {e}")

# Check Dockerfile for MySQL client
if md.get("database_type") == "mysql" and md.get("use_docker"):
try:
dockerfile = template_engine.render_template("project/Dockerfile-tpl", ctx)
if "default-libmysqlclient-dev" not in dockerfile and "mysqlclient" not in dockerfile:
issues.append(f"{name}: MySQL client missing in Dockerfile")
except Exception as e:
issues.append(f"{name}: Dockerfile error - {e}")

return issues


def check_settings():
"""Check settings templates for correct conditional includes."""
print("\n" + "=" * 70)
print(" CHECKING SETTINGS")
print("=" * 70)

issues = []

test_cases = [
{"use_vite": True, "use_tailwind": False, "use_htmx": False},
{"use_vite": False, "use_tailwind": True, "use_htmx": False},
{"use_vite": False, "use_tailwind": False, "use_htmx": True},
{"use_vite": True, "use_tailwind": True, "use_htmx": True},
]

for ctx in test_cases:
full_ctx = {"project_name": "config", "app_names": [], **ctx}
try:
settings = template_engine.render_template("config/settings/base.py-tpl", full_ctx)

# Check django_vite
if ctx.get("use_vite") and "django_vite" not in settings:
issues.append(f"settings with {ctx}: django_vite missing")

if ctx.get("use_vite") and "DJANGO_VITE" not in settings:
issues.append(f"settings with {ctx}: DJANGO_VITE config missing")

# Check django_tailwind
if ctx.get("use_tailwind") and "django_tailwind_cli" not in settings:
issues.append(f"settings with {ctx}: django_tailwind_cli missing")

# Check django_htmx
if ctx.get("use_htmx") and "django_htmx" not in settings:
issues.append(f"settings with {ctx}: django_htmx missing")

except Exception as e:
issues.append(f"settings error with {ctx}: {e}")

return issues


def check_vite_templates():
"""Check vite/frontend templates."""
print("\n" + "=" * 70)
print(" CHECKING VITE/FRONTEND TEMPLATES")
print("=" * 70)

ctx = {"project_name": "test", "module_name": "config"}
templates = [
"project/vite.config.js-tpl",
"project/package.json-tpl",
"project/frontend/index.html-tpl",
"project/frontend/src/main.jsx-tpl",
"project/frontend/src/App.jsx-tpl",
"project/frontend/src/index.css-tpl",
]

issues = []

for tpl in templates:
try:
content = template_engine.render_template(tpl, ctx)
# Check for unreplaced variables
if "[[" in content:
issues.append(f"{tpl}: has unreplaced [[ variables")
except Exception as e:
issues.append(f"{tpl}: error - {e}")

return issues


def main():
print("DJINIT BUG CHECK")
print("=" * 70)

all_issues = []

# Run all checks
all_issues.extend(check_template_consistency())
all_issues.extend(check_metadata_usage())
all_issues.extend(check_all_use_cases())
all_issues.extend(check_settings())
all_issues.extend(check_vite_templates())

# Report
print("\n" + "=" * 70)
print(" BUG CHECK SUMMARY")
print("=" * 70)

if all_issues:
print(f"\nFound {len(all_issues)} issues:")
for issue in all_issues:
print(f" ✗ {issue}")
else:
print("\n ✓ No issues found!")

print("\n" + "=" * 70)
print(" COMPLETED")
print("=" * 70)


if __name__ == "__main__":
main()
Loading
Loading