70 Commits
Author SHA1 Message Date
sankalp d6fa789804 chore(root): bump versioin to 0.3.7 2026-09-11 14:32:15 +05:45
sankalp 8b48a9b9bb feat(templates): upgrade to Django 6.1 and MAILERS
Require django>=6.1 in pyproject, bump ruff/pytest/pytest-django,
point docs at 6.1, drop removed SECURE_BROWSER_XSS_FILTER and
STATICFILES_STORAGE settings. Replace deprecated EMAIL_* settings
with the Django 6.1 MAILERS dict.
2026-09-10 22:33:08 +05:45
sankalp 9793da4dbf refactor(templates/project): simplify manage.py env loading
Load .env once at top via BASE_DIR, drop duplicate environ setup in __main__.
2026-09-10 22:12:46 +05:45
sankalp 9b6edfec0e fix(templates/project): use project_name in pyproject.toml
Package name, ruff known-first-party, and settings per-file-ignores
now use project_name. package_name/module_name resolved to backend or
config/core, producing wrong import resolution and settings paths.
2026-09-10 22:12:45 +05:45
dependabot[bot] dfcd598da3 chore(deps): bump ruff from 0.16.5 to 0.16.6 (#67)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.16.5 to 0.16.6.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.16.5...0.16.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-07 02:25:22 +00:00
dependabot[bot] d64ca9ddb2 chore(deps): bump ruff from 0.16.4 to 0.16.5 (#66)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.16.4 to 0.16.5.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.16.4...0.16.5)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-31 02:25:43 +00:00
dependabot[bot] 3e6cb2f055 chore(deps): bump ruff from 0.16.3 to 0.16.4 (#65)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.16.3 to 0.16.4.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.16.3...0.16.4)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-24 02:24:37 +00:00
dependabot[bot] 5ce5ebbb09 chore(deps): bump ruff from 0.16.1 to 0.16.3 (#64)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.16.1 to 0.16.3.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.16.1...0.16.3)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-17 02:26:54 +00:00
dependabot[bot] ca79f1968e chore(deps): bump pre-commit from 4.6.1 to 4.6.2 (#63)
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 4.6.1 to 4.6.2.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v4.6.1...v4.6.2)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-version: 4.6.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-17 02:24:31 +00:00
dependabot[bot] ca077e380c chore(deps): bump ruff from 0.16.0 to 0.16.1 (#62)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.16.0 to 0.16.1.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.16.0...0.16.1)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-03 02:24:55 +00:00
dependabot[bot] 44299ed8a9 chore(deps): bump pre-commit from 4.6.0 to 4.6.1 (#61)
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 4.6.0 to 4.6.1.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v4.6.0...v4.6.1)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-version: 4.6.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-27 02:27:07 +00:00
dependabot[bot] 916d97ffdf chore(deps): bump ruff from 0.15.22 to 0.16.0 (#60)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.22 to 0.16.0.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.22...0.16.0)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-27 02:24:41 +00:00
dependabot[bot] 66927b988a chore(deps): bump actions/setup-python from 6 to 7 (#59)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-27 02:24:16 +00:00
dependabot[bot] df68383b44 chore(deps): bump ruff from 0.15.21 to 0.15.22 (#58)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.21 to 0.15.22.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.21...0.15.22)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.22
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-20 03:08:33 +00:00
dependabot[bot] d3066a7ceb chore(deps): bump ruff from 0.15.20 to 0.15.21 (#57)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.20 to 0.15.21.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.20...0.15.21)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.21
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-13 02:24:49 +00:00
sankalp 72e6b0df0f feat: remove AGENTS.md from .gitignore 2026-07-08 16:03:43 +05:45
dependabot[bot] 7b8d6f3342 chore(deps): bump ruff from 0.15.18 to 0.15.20 (#56)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.18 to 0.15.20.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.18...0.15.20)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.20
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-29 02:24:30 +00:00
sankalp fe9eec70d5 chore(root): bump version to 0.3.6
Release 0.3.6 with updated version number.
2026-06-25 14:47:52 +05:45
sankalp ad09fa0b79 refactor(src/djinit/templates/project): adjust env_path to parent instead of parent.parent
Simplify path resolution and avoid unnecessary filesystem traversal.
2026-06-25 12:26:01 +05:45
sankalp 5984961878 fix(src/djinit/templates/config/settings): fix .env path resolution
Prevent loading .env from wrong directory when project depth varies.
2026-06-25 12:25:44 +05:45
sankalp 5b755b789c feat(src/djinit/utils): add use_tailwind flag to project metadata
Include use_tailwind setting in generated context
2026-06-25 12:16:33 +05:45
sankalp 382d2a0f56 feat(src/djinit/templates/project): load .env and use env for settings module
Replace hard‑coded settings module with environment variable and load .env configuration for smoother local development.
2026-06-25 12:16:09 +05:45
sankalp c38d4b3832 feat(src/djinit/templates/config): add tailwind live‑reload support
Prevents missing media serving and enables dev tailwind reload
2026-06-25 12:15:52 +05:45
sankalp 3200c9f9b2 feat(src/djinit/creators): add use_tailwind context for Tailwind‑enabled scaffolding
Enable conditional Tailwind inclusion in generated files based on metadata.
2026-06-25 12:15:33 +05:45
sankalp fafe29c2cb Merge branch 'main' of github.com:S4NKALP/djinit 2026-06-24 00:45:04 +05:45
sankalp 9e3f5ead8f chore(root): update project metadata and lock file
Updated version to 0.3.5, refined description, and refreshed uv.lock with new dependency list.
2026-06-24 00:42:25 +05:45
sankalp 260d41b10d feat(src/djinit/templates/config/settings): resolve env_path for settings base
Resolve env_path to correctly load .env file from project root.
2026-06-24 00:42:08 +05:45
sankalp 2d7d712ecf feat(src/djinit/templates/config): add pathlib import and explicit .env path handling
Prevents issues with mischaracterized .env locations and ensures deterministic environment loading.
2026-06-24 00:41:51 +05:45
dependabot[bot] 3ffd85d2ca chore(deps): bump ruff from 0.15.17 to 0.15.18 (#55)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.17 to 0.15.18.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.17...0.15.18)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.18
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 02:24:23 +00:00
dependabot[bot] 8c1195880d chore(deps): bump actions/checkout from 6 to 7 (#54)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 02:24:04 +00:00
sankalp c1262d02e9 Merge branch 'main' of github.com:S4NKALP/djinit 2026-06-16 15:44:10 +05:45
sankalp 63989b7f67 chore(.github/workflows): switch dependabot auto-merge target to squash
Update auto-merge configuration to use squash strategy instead of minor for cleaner merge commits.
2026-06-16 15:43:48 +05:45
sankalp b3b0c660e6 Merge pull request #53 from S4NKALP/dependabot/pip/main/ruff-0.15.17
chore(deps): bump ruff from 0.15.16 to 0.15.17
2026-06-15 08:15:14 +05:45
dependabot[bot] 3de5d577a1 chore(deps): bump ruff from 0.15.16 to 0.15.17
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.16 to 0.15.17.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.16...0.15.17)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-15 02:24:15 +00:00
sankalp e5f93e829b Merge pull request #52 from S4NKALP/dependabot/pip/main/ruff-0.15.16
chore(deps): bump ruff from 0.15.14 to 0.15.16
2026-06-08 11:12:07 +05:45
dependabot[bot] ce5cda9330 chore(deps): bump ruff from 0.15.14 to 0.15.16
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.14 to 0.15.16.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.14...0.15.16)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-08 05:21:46 +00:00
sankalp 5b76b76811 chore(root): bump version to 0.3.5
Update package version from 0.3.4 to 0.3.5 to reflect the new release.
2026-05-28 10:48:07 +05:45
sankalp 5f80a574b6 chore(root): tidy README and clarify project structure wording
Minor formatting tweaks and clarified wording.

New Features
-
Enhancements
- Updated badge links and wording for Django and Python versions.
- Adjusted bullet punctuation and wording for consistency.
- Clarified installation comment formatting.
Bug Fixes
-
2026-05-28 10:36:23 +05:45
sankalp 7bac6b176e fix(src/djinit/creators): add project_name to urls_context and urls.py template context
- Ensure project_name is passed when generating urls.py, preventing TemplateError.
- Improves template rendering consistency for API route inclusion.
2026-05-28 10:34:05 +05:45
sankalp e8176a1ff5 chore(root): complete testingframework setup
Enhancements:
- Marked testing framework setup (pytest, coverage) as done in TODO.
2026-05-28 10:34:03 +05:45
sankalp 3cfeb99946 feat(src/djinit/templates/project):add pytest and pytest-django to dev dependencies 2026-05-28 10:20:44 +05:45
sankalp 10ff50d841 feat(src/djinit/templates/config/settings): add dj_database_url import and noqa directives
Add support for optional database URL configuration and silence import-related flake8 warnings.

- New Features: Introduce conditional import of `dj_database_url` in production settings.
- Enhancements: Suppress flake8 warnings for base imports using `# noqa: F401, F403`.
- Bug Fixes: None.
2026-05-28 10:18:41 +05:45
sankalp b09a77592d feat(src/djinit/templates/project):add dev dependency group for ruff and update ruff config 2026-05-28 10:18:34 +05:45
sankalp bf97ba0dec feat(root): Introduce djinitx CLI and enrich README with full project scaffolding and usage guide
Add a concise overview of the new content and purpose.

- New Features
  - Interactive project scaffolding wizard (`djinit setup` / `dj setup`) offering multiple layouts, database options, and frontend tooling.
  - Command‑line secret generation (`djinit secret`) with customizable count and length.
  - Detailed usage examples, command shortcuts, and supported CI/CD configurations.
  - Updated installation instructions using pipx, uv, and pip.
- Enhancements
  - Switched CI configuration to GitHub Actions.
  - Added comprehensive API endpoint table, settings summary, and package reference.
  - Included installation badges and code snippets for quick start.
- Bug Fixes
  - (none reported)
2026-05-28 10:18:30 +05:45
sankalp 501c1d1159 docs(root): Update README license line to include markdown link to author's website 2026-05-28 10:11:20 +05:45
sankalp da6b60ee24 feat(src/djinit/creators): incorporate Tailwind and Vite metadata into .gitignore and justfile generation
- New Features
  - Custom .gitignore generation using use_tailwind and use_vite flags from project metadata
  - Justfile now includes Vite configuration flag context
- Enhancements
  - Dynamic template rendering with project‑specific context for better project setup reflectivity
- Bug Fixes
  - (none)
2026-05-28 10:08:26 +05:45
sankalp c14abdb03e feat(src/djinit/utils): introduce use_vite flag handling
Add `use_vite` flag to metadata processing and include it in the development context dictionary.

- New Feature: expose Vite integration flag
- Enhancement: extend dev_context with use_vite value
- No bug fixes
2026-05-28 10:08:22 +05:45
sankalp 7a9563957d feat(src/djinit/templates/project): add Vite support and update dependency handling
Introduce Vite‑based frontend workflow and adjust related templates and CI configurations. Switch drf‑spectacular to drf‑yasg, add conditional Node.js setup, and update ignored files accordingly.

- New Features
  - Conditional Vite integration via `use_vite` flag
  - npm install and build steps added to Dockerfile and CI pipelines
  - Vite dev server command added to `justfile` with `dev-full` target
  - Updated CI scripts (GitHub Actions, GitLab CI) to run Vite build when enabled
  - Dependency change from `drf-spectacular` to `drf-yasg` in `pyproject.toml`

- Enhancements
  - Modify `.gitignore` to exclude `node_modules` only when using frontend tools
  - Update Dockerfile to conditionally install Node.js packages for Vite
  - Adjust GitHub Actions and GitLab CI templates to include Node setup steps

- Bug Fixes
  - Replace `drf-spectacular` with `drf-yasg` to align with current API documentation practices
2026-05-28 10:08:19 +05:45
sankalp 197e35948f feat(root): add optional frontendtooling and restructure Django app scaffolding
New Features
- Introduce selectable frontend tooling (Tailwind CSS, HTMX, Vite) via optional scaffolding
- Add `just vite` and `just dev-full` commands for Vite integration
- Replace `drf-spectacular` with `drf-yasg` for Swagger documentation
- Update API endpoint table to list ReDoc instead of Swagger UI

Enhancements
- Reorder Django Apps selection to reflect standard structure only
- Bump project version to 0.3.4 and update roadmap in TODO.md

Bug Fixes
- Remove placeholder “Fix bugs” entry from TODO.md
2026-05-28 10:08:09 +05:45
sankalp 4025f6acf2 feat(src/djinit/templates/config): replace drf_spectacular with drf_yasg for API schema generation
- New Features
  - Switched to drf_yasg and updated schema configuration.
- Enhancements
  - Updated DEFAULT_SCHEMA_CLASS to rest_framework.schemas.coreapi.AutoSchema.
  - Refactored URL patterns to use drf_yasg schema views.
- Bug Fixes
  - No bug fixes included.
2026-05-28 10:07:58 +05:45
sankalp 2a5480ff05 feat(src/djinit/templates): AddVite‑based asset pipeline support
- New Features
  - Insert manifest_path and static_url_prefix into base settings for Vite output
  - Enable/disable dev mode via DJANGO_VITE["default"]["dev_mode"] in development and production templates
  - Add django‑vite dependency conditionally when use_vite is set in pyproject.toml and requirements
  - Create new vite.config.ts template with React, Tailwind, dev server proxy, and asset resolution
- Enhancements
  - Align Tailwind and Django settings to respect Vite mode
  - Update dependency templates to reflect Vite usage
- Bug Fixes
  - (none)
2026-05-28 09:55:41 +05:45
sankalp 5084b351a5 feat(src/djinit/ui): Introduce Vite integration options
Add Vite scaffolding support to allow users to initialize projects with Vite.

- New Features
  - Added `use_vite` flag to `StructureOptions`.
  - Added `get_vite_choice()` method to `InputCollector` with confirmation dialog.
  - Extended metadata dictionary to include `use_vite`.
  - Updated project generation to propagate Vite configuration.
- Enhancements
  - Integrated Vite confirmation into the CLI prompt flow.
  - Updated project metadata creation to include Vite settings.
2026-05-28 09:55:37 +05:45
sankalp a8af4674a0 feat(src/djinit/core): add use_vite flag to ProjectMetadata
Add a boolean `use_vite` to `ProjectMetadata` to control Vite integration and include it in the serialized project metadata.

- New Features: Introduce `use_vite` configuration option.
- Enhancements: Expose `use_vite` in metadata output.
2026-05-28 09:55:30 +05:45
sankalp 86906070aa chore(root): complete Docker Support and Frontend Integration
Marked Docker Support and Frontend Integration tasks as completed.
2026-05-28 09:55:26 +05:45
sankalp d96db6b313 feat(src/djinit/creators): add Vite support for frontend bundling
Introduce Vite configuration generation and propagate the use_vite flag across templates to enable modern frontend tooling.

New Features- Add `create_vite_config` method to generate `vite.config.ts`.
- Propagate `use_vite` metadata to all relevant context dictionaries.
- Include Vite usage in Dockerfile, requirements.txt, pyproject.toml, and CI pipelines.

Enhancements
- Update context preparation to embed Vite flag alongside Tailwind and HTMX.
- Refine template documentation to mention Tailwind, HTMX, and Vite integration.

Bug Fixes
- None.
2026-05-28 09:55:22 +05:45
sankalp 0472a6f00b feat(src/djinit/creators): add use_tailwind and use_htmx metadata to pyproject.toml and CI templates
The new metadata enables optional Tailwind CSS and HTMX support in generated Django projects, expanding customization capabilities.

New Features:
- Expose `use_tailwind` and `use_htmx` flags in the pyproject.toml template.
- Inject these flags into GitHub Actions and GitLab CI configuration templates.

Enhancements:
- Centralized handling of Tailwind and HTMX configuration flags across all generated files.
2026-05-28 09:33:05 +05:45
sankalp 29306ef865 chore(root): bump uv.lock lockfile
The uv.lock file has been updated to reflect the latest dependency versions, ensuring consistent and reproducible builds.

Enhancements
- Upgraded key dependencies (cfgv, click, colorama, distlib, djinitx) to newer releases.
- Improved build reproducibility and security posture.

Bug Fixes
- None
2026-05-28 09:33:01 +05:45
sankalp 90da64612f chore(src/djinit/templates/project/ci): streamline CI jobs and improve caching
The CI templates were refactored to simplify configuration, remove redundant services, and enable better cache reuse while maintaining compatibility across Python versions.

- New Features
  - Consolidated caching logic with `cache-suffix` per Python version.
  - Integrated security check directly into the main pipeline.

- Enhancements
  - Reduced matrix size to only Python 3.13.
  - Replaced manual PostgreSQL setup with Django checks using `DJANGO_SETTINGS_MODULE` and `SECRET_KEY`.
  - Merged duplicate test and security steps across CI platforms.

- Bug Fixes
  - Fixed missing `python-version` entries that caused undefined matrix behavior.
  - Resolved duplicate environment variable definitions in GitLab CI.
2026-05-28 09:32:57 +05:45
sankalp 4609ff6eb1 feat(src/djinit/templates/project): add optional Tailwind, HTMX, and database URL dependenciesAdd conditional dependencies for Tailwind, HTMX, and database URL in pyproject.toml template; update dockerignore to include staticfiles; fix Dockerfile CMD newline handling.
Details:
- New Features: Conditional Tailwind, HTMX, and database URL dependencies
- Enhancements: Updated dockerignore to include staticfiles
- Bug Fixes: Fixed Dockerfile CMD newline handling
2026-05-28 09:32:52 +05:45
sankalp b6e1d39132 feat(src/djinit/templates/project): add Dockerfile and dockerignore templates
Introduce Dockerfile and dockerignore templates to scaffold Docker‑ready Django projects, providing conditional system‑level dependencies for databases and optional Tailwind support, and a comprehensive ignore list for generated projects.

- New Features
  - Dockerfile template with conditional apt packages for MySQL or PostgreSQL, and optional Tailwind installation.
  - dockerignore template covering Python bytecode, virtual environments, OS artifacts, Django static/media files, and common VCS files.

- Enhancements
  - Expand project scaffolding to include ready‑to‑use container configuration files.
2026-05-28 09:22:33 +05:45
sankalp 05c329b595 feat(src/djinit/creators): add Dockerfile and .dockerignore generation for new projects
Introduce automatic creation of Dockerfile and .dockerignore during project scaffolding, enabling container‑ready setups out of the box.

* New Features
  - `create_dockerfile` method renders Dockerfile with configurable context (module name, database type, Tailwind usage).
  - `create_dockerignore` method generates a .dockerignore file to exclude unnecessary files from containers.
* Enhancements
  - Added both methods to the setup pipeline in `SetupCreator` so they are executed automatically.
  - Context values are derived from project metadata, allowing customization per project.
* Bug Fixes  - None
2026-05-28 09:22:29 +05:45
sankalp abb5bd2aa1 Merge pull request #50 from S4NKALP/dependabot/pip/main/ruff-0.15.14
chore(deps): bump ruff from 0.15.13 to 0.15.14
2026-05-25 20:11:06 +05:45
dependabot[bot] e0d686ade3 chore(deps): bump ruff from 0.15.13 to 0.15.14
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.13 to 0.15.14.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.13...0.15.14)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.14
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-25 02:50:28 +00:00
sankalp 3d86539db6 fix(src/djinit/templates/project): update FRONTEND_URL default to include https:// for www subdomain
Enhancements:
- Updated FRONTEND_URL default from `https://frontend.your-domain.com,www.frontend.your-domain.com` to `https://frontend.your-domain.com,https://www.frontend.your-domain.com` to ensure consistent HTTPS usage.
2026-05-18 18:16:28 +05:45
sankalp 4e2869a8f6 Merge pull request #49 from S4NKALP/dependabot/pip/main/ruff-0.15.13
chore(deps): bump ruff from 0.15.12 to 0.15.13
2026-05-18 10:44:40 +05:45
dependabot[bot] d44a906bab chore(deps): bump ruff from 0.15.12 to 0.15.13
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.12 to 0.15.13.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.12...0.15.13)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-18 02:55:16 +00:00
sankalp 175592f82a Merge pull request #47 from S4NKALP/dependabot/pip/main/pre-commit-4.6.0 2026-05-04 09:53:37 +05:45
dependabot[bot] 221a5d7d03 chore(deps): bump pre-commit from 4.5.1 to 4.6.0
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 4.5.1 to 4.6.0.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/pre-commit/pre-commit/compare/v4.5.1...v4.6.0)

---
updated-dependencies:
- dependency-name: pre-commit
  dependency-version: 4.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-04 04:08:22 +00:00
sankalp fde8c0b5e2 Merge pull request #46 from S4NKALP/dependabot/pip/main/ruff-0.15.12 2026-05-04 09:52:12 +05:45
dependabot[bot] fb48a7bd17 chore(deps): bump ruff from 0.15.11 to 0.15.12
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.11 to 0.15.12.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.11...0.15.12)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.15.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-27 02:30:21 +00:00
34 changed files with 565 additions and 408 deletions

No files matched your search

+2 -2
View File
@@ -16,10 +16,10 @@ jobs:
python-version: ["3.13"]
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
+1 -1
View File
@@ -19,4 +19,4 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
use-github-auto-merge: true
target: minor
target: squash
+2 -2
View File
@@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.13"
+2 -2
View File
@@ -11,9 +11,9 @@ jobs:
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: '3.12'
cache: 'pip'
-2
View File
@@ -1,8 +1,6 @@
#--------------------------------------------------#
# The following was generated by djinit: #
#--------------------------------------------------#
AGENTS.md
# Python
*.py[cod]
*$py.class
+113 -168
View File
@@ -1,145 +1,128 @@
# djinit
<div align="center">
> PyPI didn't allow the original name, so you'll find it as **djinitx** on PyPI
<div align="center">
<img src="https://img.shields.io/pypi/v/djinitx?color=blue&label=PyPI&logo=pypi&logoColor=white" alt="PyPI">
<img src="https://img.shields.io/badge/Django-4.2%20%7C%205.1%20%7C%205.2-0C4B33?logo=django&logoColor=white" alt="Django">
<img src="https://img.shields.io/badge/Django-5.1%20%7C%205.2%20%7C%206.0-0C4B33?logo=django&logoColor=white" alt="Django">
<img src="https://img.shields.io/badge/Python-3.13%2B-3776AB?logo=python&logoColor=white" alt="Python">
<a href="https://github.com/S4NKALP/djinit/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a>
</div>
**djinit** helps you set up a production‑ready Django project in minutes. No more copy‑pasting settings or manually wiring up apps—just answer a few questions and get a modern Django project with REST API, authentication, documentation, and deployment configs ready to go.
## Why djinit?
Starting a Django project usually means spending hours setting up the same things: splitting settings for dev/prod, configuring DRF, adding JWT auth, setting up CORS, preparing for deployment. djinit does all of this for you with sensible defaults and lets you choose the project structure that fits your needs.
## Installation
**Recommended** (using pipx):
A CLI that scaffolds production-ready Django projects with DRF, JWT auth, API docs, and deployment configs - all through an interactive wizard. No more copy-pasting settings or wiring up apps by hand.
```bash
pipx install djinitx
djinit setup
```
Or with pip:
## Installation
```bash
# Recommended - isolated environment
pipx install djinitx
# Or with uv
uv tool install djinitx
# Or with pip
pip install djinitx
```
Or with uv:
Requires Python 3.13+.
```bash
uv tool install djinitx
```
## Usage
**Requirements**: Python 3.13+
## Getting Started
### Create a project
```bash
djinit setup
```
or the shorter alias:
```bash
# or
dj setup
```
The wizard will ask you a few questions:
The wizard walks you through these choices:
1. **What structure do you want?**
- **Standard** – Classic Django layout with split settings
- **Predefined** – Organized with `apps/` and `api/` folders (great for larger projects)
- **Unified** – Everything under `core/` and `apps/` (clean and minimal)
- **Single Folder** – All apps in one configurable folder (simple and flat)
1. **Project structure** - Standard, Predefined (`apps/` + `api/`), Unified (`core/` + `apps/`), or Single Folder
2. **Project name and directory**
3. **Database** - PostgreSQL or MySQL; `DATABASE_URL` or individual env vars
4. **Frontend tools** - Tailwind CSS, HTMX, and/or Vite (optional)
5. **Django apps** - Name them; optionally nest under an `apps/` package
6. **CI/CD** - GitHub Actions, GitLab CI, both, or none
2. **Project Setup** – Destination directory (use `.` for current) and project name.
When you're done, you have a fully configured Django project ready to run.
3. **Database Configuration** – Choose `DATABASE_URL` (recommended) or individual variables; pick PostgreSQL or MySQL.
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.
That’s it—your project will be ready with everything configured.
## What You Get
- **Split settings** for development and production
- **Django REST Framework** with JWT authentication
- **API documentation** (Swagger UI at `/docs/`)
- **CORS** configured for local development
- **WhiteNoise** for static files
- **PostgreSQL** support (SQLite for dev)
- **Modern admin** interface (`django-jazzmin`)
- **Deployment ready** with `Procfile` and `runtime.txt`
- **Development tools** (`Justfile` with common commands)
- **Environment template** (`.env.sample`)
- **Git ready** (`.gitignore` included)
## Commands
### Create a Project
```bash
djinit setup
```
### Add Apps to an Existing Project
### Add apps later
```bash
djinit app users products orders
```
Creates the apps, adds them to `INSTALLED_APPS`, and wires up URLs.
Creates the apps, registers them in `INSTALLED_APPS`, and wires up URL includes.
### Generate Secret Keys
### Generate secret keys
```bash
djinit secret
djinit secret --count 5 --length 64
```
Use `--count 5` to generate five keys or `--length 64` to change the length.
## What You Get
Every project ships with:
- **Split settings** - `base.py`, `development.py`, `production.py` with sensible defaults
- **Django REST Framework** - With JWT authentication (access + refresh tokens)
- **API documentation** - Swagger UI at `/docs/`, ReDoc at `/schema/`
- **CORS** - Configured for local dev, locked down for production
- **WhiteNoise** - Static file serving, production-ready
- **django-jazzmin** - Modern admin interface
- **Environment management** - `.env.sample` with `django-environ`
- **Deployment configs** - `Dockerfile`, `Procfile`, `runtime.txt`
- **CI/CD pipelines** - GitHub Actions and/or GitLab CI
- **Task runner** - `Justfile` with common commands
- **`.gitignore`** - Python + Node defaults
Optional add-ons when selected:
| Feature | Package | What's configured |
|---|---|---|
| Tailwind CSS | django-tailwind-cli | Settings, DaisyUI theme, Node install in Docker |
| HTMX | django-htmx | Installed app + HtmxMiddleware |
| Vite | django-vite | `vite.config.ts`, dev/prod mode toggles, CI build step |
### Development workflow
```bash
just dev # Start dev server
just migrate # Run migrations
just test # Run tests
just lint # Lint with ruff
just format # Format with ruff
just vite # Start Vite dev server (if selected)
just dev-full # Django + Vite together (if selected)
```
No `just` installed? These map directly to Django management commands.
## Project Structures
### Standard Structure
### Standard
```
myproject/
├── manage.py
├── myproject/ # Config module
│ ├── settings/ # Split settings
│ ├── settings/ # base.py, development.py, production.py
│ ├── urls.py
│ └── wsgi.py
└── apps/ # Your apps (optional)
└── users/
```
### Single Folder Layout
```
myproject/
├── manage.py
├── project/ # Configurable folder name
│ ├── settings/
│ ├── urls.py
│ ├── models/ # All models here
│ ├── api/ # API views & serializers
│ │ └── your_model_name/
│ │ ├── views.py
│ │ ├── serializers.py
│ │ └── urls.py
│ └── wsgi.py
```
### Predefined Structure
### Predefined
```
myproject/
@@ -154,7 +137,7 @@ myproject/
└── v1/
```
### Unified Structure
### Unified
```
myproject/
@@ -168,107 +151,69 @@ myproject/
├── serializers/
├── views/
├── urls/
└── api/ # API routes
└── api/
```
## Development Workflow
### Single Folder
Your project ships with a `Justfile` for common tasks:
```bash
just dev # Start dev server
just migrate # Run migrations
just makemigrations # Create migrations
just shell # Django shell
just test # Run tests
just format # Format code
just lint # Lint code
```
If you don’t have `just` installed, these are just shortcuts for the equivalent Django commands.
## What's Included
### Packages
- **Django** – Web framework
- **Django REST Framework** – API toolkit
- **djangorestframework‑simplejwt** – JWT authentication
- **drf‑spectacular** – OpenAPI/Swagger docs
- **django‑cors‑headers** – CORS handling
- **django‑jazzmin** – Modern admin UI
- **whitenoise** – Static file serving
- **psycopg2‑binary** – PostgreSQL driver
- **gunicorn** – Production WSGI server
- **python‑dotenv** – `.env` handling
### API Endpoints
| Endpoint | Description |
|-------------------|---------------------------------|
| `/admin/` | Django admin |
| `/token/` | Obtain JWT token |
| `/token/refresh/` | Refresh JWT token |
| `/docs/` | Swagger UI (dev only) |
| `/schema/` | OpenAPI schema (dev only) |
### Settings Overview
- **Development** – SQLite, `DEBUG=True`, console email backend, permissive CORS.
- **Production** – PostgreSQL, hardened security settings, SMTP email backend, strict CORS.
myproject/
├── manage.py
├── project/ # Configurable name
│ ├── settings/
│ ├── urls.py
│ ├── models/
│ ├── api/
│ └── wsgi.py
```
## Environment Setup
Copy the sample file and fill in your values:
```bash
cp .env.sample .env
```
```dotenv
SECRET_KEY=your-secret-key-here # Generate with: djinit secret
DATABASE_URL=postgres://user:pass@host:5432/db
ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com
```
SQLite works out of the box for development. Swap in your production database when you're ready.
SQLite works out of the box for development—no extra DB setup required.
## Packages
## Roadmap
| Package | Role |
|---|---|
| Django | Web framework |
| django-environ | Environment variable management |
| django-jazzmin | Admin UI |
| djangorestframework | REST API toolkit |
| djangorestframework-simplejwt | JWT authentication |
| drf-yasg | Swagger/OpenAPI docs |
| django-cors-headers | CORS handling |
| whitenoise | Static file serving |
| gunicorn | Production WSGI server |
| psycopg[binary] | PostgreSQL driver |
| django-tailwind-cli | Tailwind CSS _(optional)_ |
| django-htmx | HTMX _(optional)_ |
| django-vite | Vite bundler _(optional)_ |
The following items are tracked in **TODO.md** and represent the near‑future direction of djinit.
## API Endpoints
### 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!
| Endpoint | Description |
|---|---|
| `/admin/` | Django admin |
| `/token/` | Obtain JWT pair |
| `/token/refresh/` | Refresh access token |
| `/docs/` | Swagger UI |
| `/schema/` | ReDoc |
## Contributing
Found a bug or have an idea? Open an issue or submit a pull request. Contributions are always welcome!
Contributions are welcome. Open an issue or submit a PR.
1. Fork the repository.
2. Create a feature branch (`git checkout -b feature/awesome-feature`).
3. Make your changes and ensure tests pass (`just test`).
4. Submit a pull request with a clear description of the change.
1. Fork the repo
2. Create a feature branch (`git checkout -b feature/whatever`)
3. Make your changes and run `just test`
4. Submit a pull request
Please follow the existing code style (ruff + black) and include tests for new functionality.
Match the existing code style - ruff linting and formatting are enforced.
## License
MIT © Sankalp Tharu
---
*© 2024 Sankalp Tharu. All rights reserved.*
MIT © [Sankalp Tharu](https://sankalptharu.com.np)
+3 -4
View File
@@ -2,8 +2,8 @@
## Features
- [ ] Docker Support: Auto generating `Dockerfile` so you can containerize easily
- [ ] Frontend Integration: Options to scaffold React, Vue, or HTMX right alongside Django
- [x] Docker Support: Auto generating `Dockerfile` so you can containerize easily
- [x] Frontend Integration: Options to scaffold React, Vue, or HTMX right alongside Django
- [ ] Celery: Making background tasks easier to set up
- [ ] More Packages: Integrating other popular packages to help you build feature rich apps effortlessly
@@ -11,6 +11,5 @@
- [ ] Add more project structure templates
- [x] Add interactive configuration wizard
- [ ] Add testing framework setup (pytest, coverage)
- [x] Add testing framework setup (pytest, coverage)
- [x] Improve structure detection
- [ ] Fix bugs
+1 -1
View File
@@ -7,7 +7,7 @@ packages = ["src/djinit"]
[project]
name = "djinitx"
version = "0.3.4"
version = "0.3.7"
description = "A CLI tool to setup Django project"
readme = "README.md"
requires-python = ">=3.10"
+2 -2
View File
@@ -1,5 +1,5 @@
questionary==2.1.1
rich==15.0.0
# dev
ruff==0.15.11
pre-commit==4.5.1
ruff==0.16.6
pre-commit==4.6.2
+1 -1
View File
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
setup(
name="djinitx",
version="0.3.4",
version="0.3.7",
description="A CLI tool to setup Django projects",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
+2
View File
@@ -17,6 +17,7 @@ class ProjectMetadata:
database_type: str = "postgresql"
use_tailwind: bool = False
use_htmx: bool = False
use_vite: bool = False
predefined_structure: bool = False
unified_structure: bool = False
single_structure: bool = False
@@ -33,6 +34,7 @@ class ProjectMetadata:
"database_type": self.database_type,
"use_tailwind": self.use_tailwind,
"use_htmx": self.use_htmx,
"use_vite": self.use_vite,
"predefined_structure": self.predefined_structure,
"unified_structure": self.unified_structure,
"single_structure": self.single_structure,
+85 -7
View File
@@ -77,6 +77,7 @@ class FileCreator(BaseService):
secret_key = generate_secret_key()
dev_context = {"secret_key": secret_key}
dev_context["use_vite"] = self.metadata.get("use_vite", False)
# Prepare context for base.py with full AppConfig paths
base_settings_context = base_context.copy()
@@ -88,9 +89,10 @@ class FileCreator(BaseService):
for name in base_settings_context["app_names"]
]
# Add Tailwind and HTMX to context
# Add Tailwind, HTMX, and Vite to context
base_settings_context["use_tailwind"] = self.metadata.get("use_tailwind", False)
base_settings_context["use_htmx"] = self.metadata.get("use_htmx", False)
base_settings_context["use_vite"] = self.metadata.get("use_vite", False)
for filename, context in [
("base.py", base_settings_context),
@@ -115,7 +117,13 @@ class FileCreator(BaseService):
) -> None:
"""Helper to create urls.py, wsgi.py, and asgi.py."""
urls_context = {"url_type": "project", "api_module": api_module, "include_api": True}
urls_context = {
"url_type": "project",
"project_name": self.project_name,
"api_module": api_module,
"include_api": True,
"use_tailwind": self.metadata.get("use_tailwind", False),
}
if comment_out_api:
urls_context["comment_out_api_url"] = True
@@ -131,8 +139,46 @@ class FileCreator(BaseService):
filepath, template, context, f"Created {prefix}/{filename}", should_format=True
)
def create_dockerfile(self) -> None:
context = {
"module_name": self.module_name,
"database_type": self.metadata.get("database_type", "postgresql"),
"use_tailwind": self.metadata.get("use_tailwind", False),
"use_vite": self.metadata.get("use_vite", False),
}
self._render_and_create_file(
"Dockerfile",
"project/Dockerfile-tpl",
context,
"Created Dockerfile for containerization",
)
def create_dockerignore(self) -> None:
self._render_and_create_file(
".dockerignore",
"project/dockerignore-tpl",
{},
"Created .dockerignore file",
)
def create_vite_config(self) -> None:
context = {
"module_name": self.module_name,
"project_name": self.project_name,
}
self._render_and_create_file(
"vite.config.ts",
"project/vite.config.ts-tpl",
context,
"Created vite.config.ts for Vite frontend bundling",
)
def create_gitignore(self) -> None:
self._render_and_create_file(".gitignore", "project/gitignore-tpl", {}, "Created .gitignore file")
context = {
"use_tailwind": self.metadata.get("use_tailwind", False),
"use_vite": self.metadata.get("use_vite", False),
}
self._render_and_create_file(".gitignore", "project/gitignore-tpl", context, "Created .gitignore file")
def create_requirements(self) -> None:
context = {
@@ -140,6 +186,7 @@ class FileCreator(BaseService):
"database_type": self.metadata.get("database_type", "postgresql"),
"use_tailwind": self.metadata.get("use_tailwind", False),
"use_htmx": self.metadata.get("use_htmx", False),
"use_vite": self.metadata.get("use_vite", False),
}
self._render_and_create_file(
"requirements.txt",
@@ -181,6 +228,9 @@ class FileCreator(BaseService):
"module_name": self.module_name,
"database_type": metadata.get("database_type", "postgresql"),
"use_database_url": metadata.get("use_database_url", True),
"use_tailwind": metadata.get("use_tailwind", False),
"use_htmx": metadata.get("use_htmx", False),
"use_vite": metadata.get("use_vite", False),
}
self._render_and_create_file(
"pyproject.toml",
@@ -198,6 +248,7 @@ class FileCreator(BaseService):
"app_names": effective_app_modules,
"include_apps": True,
"include_api": True,
"use_tailwind": self.metadata.get("use_tailwind", False),
}
self._render_and_create_file(
"urls.py",
@@ -209,7 +260,11 @@ class FileCreator(BaseService):
)
def create_justfile(self) -> None:
context = {"project_name": self.project_name, "module_name": self.module_name}
context = {
"project_name": self.project_name,
"module_name": self.module_name,
"use_vite": self.metadata.get("use_vite", False),
}
self._render_and_create_file(
"justfile",
"project/justfile-tpl",
@@ -255,7 +310,13 @@ class FileCreator(BaseService):
CommonUtils.create_file_from_template(
project_urls_path,
"config/urls.py-tpl",
{"url_type": "project", "api_module": "api", "include_api": True},
{
"url_type": "project",
"project_name": self.project_name,
"api_module": "api",
"include_api": True,
"use_tailwind": self.metadata.get("use_tailwind", False),
},
"Updated project urls.py to include API routes",
should_format=True,
)
@@ -376,7 +437,15 @@ class FileCreator(BaseService):
def create_github_actions(self) -> None:
github_dir = os.path.join(self.project_root, ".github", "workflows")
os.makedirs(github_dir, exist_ok=True)
context = {"project_name": self.project_name, "module_name": self.module_name}
context = {
"project_name": self.project_name,
"module_name": self.module_name,
"database_type": self.metadata.get("database_type", "postgresql"),
"use_database_url": self.metadata.get("use_database_url", True),
"use_tailwind": self.metadata.get("use_tailwind", False),
"use_htmx": self.metadata.get("use_htmx", False),
"use_vite": self.metadata.get("use_vite", False),
}
workflow_file = os.path.join(github_dir, "ci.yml")
self._render_and_create_file(
workflow_file,
@@ -387,7 +456,15 @@ class FileCreator(BaseService):
)
def create_gitlab_ci(self) -> None:
context = {"project_name": self.project_name, "module_name": self.module_name}
context = {
"project_name": self.project_name,
"module_name": self.module_name,
"database_type": self.metadata.get("database_type", "postgresql"),
"use_database_url": self.metadata.get("use_database_url", True),
"use_tailwind": self.metadata.get("use_tailwind", False),
"use_htmx": self.metadata.get("use_htmx", False),
"use_vite": self.metadata.get("use_vite", False),
}
self._render_and_create_file(
".gitlab-ci.yml",
"project/ci/gitlab_ci-tpl",
@@ -421,6 +498,7 @@ class FileCreator(BaseService):
"database_type": self.metadata.get("database_type", "postgresql"),
"use_tailwind": self.metadata.get("use_tailwind", False),
"use_htmx": self.metadata.get("use_htmx", False),
"use_vite": self.metadata.get("use_vite", False),
},
"cicd": {
"github": self.metadata.get("use_github_actions", False),
+5
View File
@@ -104,12 +104,17 @@ class SetupCreator:
self.file_creator.create_readme,
self.file_creator.create_env_file,
self.file_creator.create_djinit_config,
self.file_creator.create_dockerfile,
self.file_creator.create_dockerignore,
lambda: self.file_creator.create_pyproject(self.metadata),
]
for step_func in utility_steps:
step_func()
if self.metadata.get("use_vite", False):
self.file_creator.create_vite_config()
UIFormatter.print_success("Created all utility files successfully!")
def _create_cicd_pipelines(self) -> None:
+3 -1
View File
@@ -1,11 +1,13 @@
"""generated with djinit"""
import os
from pathlib import Path
import environ
from django.core.asgi import get_asgi_application
env_path = Path(__file__).resolve().parent.parent / ".env"
env = environ.Env()
environ.Env.read_env()
environ.Env.read_env(env_path)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE", default="[[ project_name ]].settings.production"))
application = get_asgi_application()
@@ -9,14 +9,15 @@ from pathlib import Path
import environ
env_path = Path(__file__).resolve().parent.parent.parent / ".env"
env = environ.Env()
environ.Env.read_env()
environ.Env.read_env(env_path)
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/6.1/howto/deployment/checklist/
# Application definition
@@ -25,7 +26,7 @@ THIRD_PARTY_APPS = [
"rest_framework_simplejwt",
"rest_framework_simplejwt.token_blacklist",
"corsheaders",
"drf_spectacular",
"drf_yasg",
"django_tailwind_cli", # @IF use_tailwind
"django_htmx", # @IF use_htmx
]
@@ -82,7 +83,7 @@ WSGI_APPLICATION = "[[ project_name ]].wsgi.application"
# Password validation
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/6.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
@@ -101,7 +102,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/5.2/topics/i18n/
# https://docs.djangoproject.com/en/6.1/topics/i18n/
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
@@ -138,21 +139,11 @@ REST_FRAMEWORK = {
"rest_framework_simplejwt.authentication.JWTAuthentication",
"rest_framework.authentication.SessionAuthentication",
),
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
"DEFAULT_SCHEMA_CLASS": "rest_framework.schemas.coreapi.AutoSchema",
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
"PAGE_SIZE": 20,
}
# DRF Spectacular settings
SPECTACULAR_SETTINGS = {
"TITLE": "[[ project_name ]] API",
"DESCRIPTION": "API documentation for [[ project_name ]]",
"VERSION": "1.0.0",
"SERVE_INCLUDE_SCHEMA": False,
"COMPONENT_SPLIT_REQUEST": True,
"SCHEMA_PATH_PREFIX": "/api/",
}
# JWT Settings
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(days=1),
@@ -185,7 +176,6 @@ CORS_ALLOW_HEADERS = [
CORS_PREFLIGHT_MAX_AGE = 86400 # 24 hours
# Security Settings
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
X_FRAME_OPTIONS = "DENY"
@@ -225,3 +215,13 @@ TAILWIND_CLI_CONFIG = {
},
}
# @ENDIF
# @IF use_vite
# Vite Settings
DJANGO_VITE = {
"default": {
"manifest_path": BASE_DIR / "static" / "dist" / "manifest.json",
"static_url_prefix": "dist",
}
}
# @ENDIF
@@ -1,6 +1,6 @@
"""generated with djinit"""
from .base import *
from .base import * # noqa: F401, F403
SECRET_KEY = "[[ secret_key ]]"
@@ -10,7 +10,7 @@ DEBUG = True
ALLOWED_HOSTS = ["*"]
# Database
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
# https://docs.djangoproject.com/en/6.1/ref/settings/#databases
DATABASES = {
"default": {
@@ -30,8 +30,12 @@ DATABASES = {
}
}
# Email backend for development
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
# Email settings for development
MAILERS = {
"default": {
"BACKEND": "django.core.mail.backends.console.EmailBackend",
},
}
# CORS settings for development
# Allow all origins in development (convenient but not secure)
@@ -40,3 +44,8 @@ CORS_ALLOW_CREDENTIALS = True
# Disable HTTPS redirect in development
SECURE_SSL_REDIRECT = False
# @IF use_vite
# Vite Settings
DJANGO_VITE["default"]["dev_mode"] = True
# @ENDIF
@@ -1,6 +1,6 @@
"""generated with djinit"""
from .base import *
from .base import * # noqa: F401, F403
# @IF use_database_url
import dj_database_url
# @ENDIF
@@ -43,14 +43,20 @@ CORS_ALLOW_CREDENTIALS = True
CORS_ALLOW_PRIVATE_NETWORK = False
# Email settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = env('EMAIL_HOST', default="smtp.gmail.com")
EMAIL_PORT = env.int('EMAIL_PORT', default=587)
EMAIL_USE_TLS = env.bool('EMAIL_USE_TLS', default=True)
EMAIL_HOST_USER = env('EMAIL_HOST_USER', default="")
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD', default="")
DEFAULT_FROM_EMAIL = env('EMAIL_HOST_USER', default="")
SERVER_EMAIL = env('EMAIL_HOST_USER', default="")
MAILERS = {
'default': {
'BACKEND': 'django.core.mail.backends.smtp.EmailBackend',
'OPTIONS': {
'host': env('EMAIL_HOST', default='smtp.gmail.com'),
'port': env.int('EMAIL_PORT', default=587),
'use_tls': env.bool('EMAIL_USE_TLS', default=True),
'username': env('EMAIL_HOST_USER', default=''),
'password': env('EMAIL_HOST_PASSWORD', default=''),
},
},
}
DEFAULT_FROM_EMAIL = env('EMAIL_HOST_USER', default='')
SERVER_EMAIL = env('EMAIL_HOST_USER', default='')
# Security settings for production
SECURE_SSL_REDIRECT = True
@@ -63,12 +69,14 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
# Static files
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# @IF use_tailwind
## Tailwind
TAILWIND_CLI_VERSION = "4.1.3" # Pin version
TAILWIND_CLI_AUTOMATIC_DOWNLOAD = False # Use pre-installed CLI
TAILWIND_CLI_DIST_CSS = "static/css/tailwind.min.css"
# @ENDIF
# @IF use_vite
# Vite Settings
DJANGO_VITE["default"]["dev_mode"] = False
# @ENDIF
+30 -8
View File
@@ -2,16 +2,15 @@
"""generated with djinit"""
from django.contrib import admin
from django.urls import path
from django.urls import path, re_path
from django.conf import settings
from django.views.static import serve
# @IF include_api or include_apps
from django.urls import include
# @ENDIF
# @IF include_api
from django.conf import settings
from drf_spectacular.views import (
SpectacularAPIView,
SpectacularSwaggerView,
)
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from rest_framework_simplejwt.views import (
TokenObtainPairView,
TokenRefreshView,
@@ -44,11 +43,34 @@ urlpatterns = [
# Don't show schema in production
if settings.DEBUG:
schema_view = get_schema_view(
openapi.Info(
title="[[ project_name ]] API",
default_version="v1",
),
public=True,
)
urlpatterns += [
path("schema/", SpectacularAPIView.as_view(), name="schema"),
path("docs/", SpectacularSwaggerView.as_view(url_name="schema")),
path("docs/", schema_view.with_ui("swagger", cache_timeout=0)),
path("schema/", schema_view.with_ui("redoc", cache_timeout=0)),
]
# @ENDIF
# @IF use_tailwind
# django-browser-reload for tailwind live reload (dev only)
if settings.DEBUG:
urlpatterns += [
path("__reload__/", include("django_browser_reload.urls")),
]
# @ENDIF
urlpatterns += [
re_path(
r"^media/(?P<path>.*)$",
serve,
{"document_root": settings.MEDIA_ROOT},
),
]
# @ENDIF
# @IF url_type == 'api_root'
from django.urls import include, path
+3 -1
View File
@@ -1,11 +1,13 @@
"""generated with djinit"""
import os
from pathlib import Path
import environ
from django.core.wsgi import get_wsgi_application
env_path = Path(__file__).resolve().parent.parent / ".env"
env = environ.Env()
environ.Env.read_env()
environ.Env.read_env(env_path)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE", default="[[ project_name ]].settings.production"))
@@ -0,0 +1,50 @@
FROM python:3.13-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /app
# @IF database_type == 'mysql'
RUN apt-get update && apt-get install -y --no-install-recommends \
default-libmysqlclient-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# @ELSE
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# @ENDIF
# @IF use_tailwind or use_vite
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
ENV NODE_VERSION=20
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# @ENDIF
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# @IF use_tailwind
RUN python manage.py tailwind install
# @ENDIF
# @IF use_vite
COPY package.json package-lock.json ./
RUN npm ci
RUN npm run build
# @ENDIF
COPY . .
RUN python manage.py collectstatic --noinput || true
EXPOSE 8000
CMD ["gunicorn", "[[ module_name ]].wsgi:application", "--bind", "0.0.0.0:8000"]
@@ -11,22 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4
@@ -39,71 +24,54 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
cache-suffix: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync
# @IF use_vite
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Build frontend
run: |
npm ci
npm run build
# @ENDIF
- name: Run linting
run: uv run ruff check .
- name: Format check
run: uv run ruff format --check .
- name: Set up PostgreSQL
env:
DB_NAME: test_db
DB_USER: postgres
DB_PASSWORD: postgres
DB_HOST: localhost
DB_PORT: 5432
run: |
echo "PostgreSQL is ready"
- name: Run Django tests
- name: Run Django checks
env:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
ALLOWED_HOSTS: localhost
DB_NAME: test_db
DB_USER: postgres
DB_PASSWORD: postgres
DB_HOST: localhost
DB_PORT: 5432
run: |
uv run python manage.py check
- name: Run tests
env:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
run: |
uv run python manage.py test
- name: Check migrations
env:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
ALLOWED_HOSTS: localhost
DB_NAME: test_db
DB_USER: postgres
DB_PASSWORD: postgres
DB_HOST: localhost
DB_PORT: 5432
run: |
uv run python manage.py makemigrations --check --dry-run
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install dependencies
run: uv sync
- name: Run security check
run: uv run python manage.py check --deploy
- name: Security check
env:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
run: |
uv run python manage.py check --deploy
+41 -98
View File
@@ -1,133 +1,76 @@
# GitLab CI/CD configuration for [[ project_name ]]
stages:
- test
- lint
- test
- security
variables:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
ALLOWED_HOSTS: localhost
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv"
cache:
paths:
- .cache/pip
- .cache/uv
- .venv/
# @IF database_type == 'mysql'
services:
- mysql:8.0
variables:
MYSQL_DATABASE: test_db
MYSQL_ROOT_PASSWORD: test_password
# @ELSE
services:
- postgres:15
variables:
POSTGRES_DB: test_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/test_db"
# Use Docker-in-Docker
services:
- postgres:15
# @ENDIF
before_script:
- python --version
- pip install uv
- uv sync
# @IF use_vite
- npm ci
- npm run build
# @ENDIF
# Lint stage
lint:
stage: lint
image: python:3.13
script:
- uv run ruff check .
- uv run ruff format --check .
only:
- branches
- merge_requests
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH == 'develop'
# Test stage
test:
stage: test
image: python:3.13
variables:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
ALLOWED_HOSTS: localhost
script:
- uv run python manage.py check
- uv run python manage.py migrate
- uv run python manage.py test
only:
- branches
- merge_requests
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH == 'develop'
# Multiple Python versions
test:python310:
stage: test
image: python:3.10
variables:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
ALLOWED_HOSTS: localhost
script:
- pip install uv
- uv sync
- uv run python manage.py check
- uv run python manage.py migrate
- uv run python manage.py test
only:
- branches
- merge_requests
test:python311:
stage: test
image: python:3.11
variables:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
ALLOWED_HOSTS: localhost
script:
- pip install uv
- uv sync
- uv run python manage.py check
- uv run python manage.py migrate
- uv run python manage.py test
only:
- branches
- merge_requests
test:python312:
stage: test
image: python:3.12
variables:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
ALLOWED_HOSTS: localhost
script:
- pip install uv
- uv sync
- uv run python manage.py check
- uv run python manage.py migrate
- uv run python manage.py test
only:
- branches
- merge_requests
test:python313:
stage: test
image: python:3.13
variables:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
ALLOWED_HOSTS: localhost
script:
- pip install uv
- uv sync
- uv run python manage.py check
- uv run python manage.py migrate
- uv run python manage.py test
only:
- branches
- merge_requests
# Security check
security:
stage: security
image: python:3.13
variables:
DJANGO_SETTINGS_MODULE: [[ module_name ]].settings.development
SECRET_KEY: test-secret-key-for-ci
script:
- pip install uv
- uv sync
- uv run python manage.py check --deploy
- uv run python manage.py validate_templates
only:
- main
- develop
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH == 'develop'
@@ -0,0 +1,26 @@
__pycache__
*.pyc
*.pyo
*.pyd
.Python
*.so
.venv
venv
ENV
.env
.git
.gitignore
*.md
README*
LICENSE
.coverage
htmlcov
.pytest_cache
.mypy_cache
.ruff_cache
.DS_Store
node_modules
*.log
db.sqlite3
media
staticfiles
+1 -1
View File
@@ -20,7 +20,7 @@ DB_PORT=
# @ENDIF
# Frontend URL
FRONTEND_URL=https://frontend.your-domain.com,www.frontend.your-domain.com
FRONTEND_URL=https://frontend.your-domain.com,https://www.frontend.your-domain.com
# Email settings
EMAIL_HOST=
@@ -71,7 +71,9 @@ yarn-debug.log*
yarn-error.log*
# Node modules (if using frontend tools)
# @IF use_tailwind or use_vite
node_modules/
# @ENDIF
# Secret keys
secret.txt
+11
View File
@@ -14,6 +14,17 @@ dev:
dev-server HOST="0.0.0.0" PORT="8000":
uv run python manage.py runserver {{ HOST }}:{{ PORT }}
# @IF use_vite
# Start Vite dev server
vite:
npm run dev
# Start both Django and Vite dev servers
dev-full:
@just dev &
@just vite
# @ENDIF
# Create migrations for all apps
makemigrations:
uv run python manage.py makemigrations
+15 -5
View File
@@ -3,15 +3,28 @@
"""generated with djinit"""
"""Django's command-line utility for administrative tasks."""
import os
import sys
from pathlib import Path
import environ
# Load environment variables from .env
BASE_DIR = Path(__file__).resolve().parent
env = environ.Env()
env.read_env(BASE_DIR / ".env")
def main():
"""Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", os.getenv("DJANGO_SETTINGS_MODULE", "[[ project_name ]].settings.production"))
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
env(
"DJANGO_SETTINGS_MODULE",
default="[[ project_name ]].settings.production",
),
)
try:
from django.core.management import execute_from_command_line
@@ -21,12 +34,9 @@ def main():
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == "__main__":
env = environ.Env()
# Read .env file, if it exists
environ.Env.read_env()
main()
@@ -1,17 +1,17 @@
[project]
name = "[[ package_name ]]"
name = "[[ project_name ]]"
version = "0.1.0"
description = ""
readme = "README.md"
requires-python = ">=3.13"
license = { text = "MIT" }
dependencies = [
"django",
"django>=6.1,<7.0",
"django-environ",
"django-jazzmin",
"djangorestframework",
"djangorestframework-simplejwt",
"drf-spectacular",
"drf-yasg",
"django-cors-headers",
"whitenoise",
# @IF database_type == 'mysql'
@@ -20,12 +20,28 @@ dependencies = [
# @IF database_type == 'postgresql'
"psycopg[binary]",
# @ENDIF
# @IF use_tailwind
"django-tailwind-cli",
# @ENDIF
# @IF use_htmx
"django-htmx",
# @ENDIF
# @IF use_vite
"django-vite",
# @ENDIF
# @IF use_database_url
"dj-database-url",
# @ENDIF
"gunicorn",
]
[dependency-groups]
dev = [
"ruff>=0.16.6",
"pytest>=9.1.1",
"pytest-django>=4.14.0",
]
[tool.ruff]
line-length = 88
target-version = "py313"
@@ -46,4 +62,7 @@ ignore = [
]
[tool.ruff.lint.isort]
known-first-party = ["[[ module_name ]]"]
known-first-party = ["[[ project_name ]]"]
[tool.ruff.lint.per-file-ignores]
"[[ project_name ]]/settings/*.py" = ["F403", "F405"]
@@ -7,11 +7,12 @@ django-environ
django-jazzmin
djangorestframework
djangorestframework_simplejwt
drf-spectacular
drf-yasg
django-cors-headers
whitenoise
django-tailwind-cli # @IF use_tailwind
django-htmx # @IF use_htmx
django-vite # @IF use_vite
# @IF database_type == 'mysql'
mysqlclient
# @ELSE
@@ -0,0 +1,44 @@
import { defineConfig } from "vite"
import react from "@vitejs/plugin-react-swc"
import tailwindcss from "@tailwindcss/vite"
import path from "path"
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
plugins: [react(), tailwindcss()],
base: mode === "production" ? "/static/" : "/",
build: {
outDir: "../[[ module_name ]]/static/dist",
emptyOutDir: true,
manifest: "manifest.json",
rollupOptions: {
input: "src/main.tsx",
},
},
server: {
port: 5173,
host: "127.0.0.1",
proxy: {
"/api": {
target: "http://localhost:8000",
changeOrigin: true,
},
"/media": {
target: "http://localhost:8000",
changeOrigin: true,
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
dedupe: [
"react",
"react-dom",
"react/jsx-runtime",
"react/jsx-dev-runtime",
"@tanstack/react-query",
],
},
}))
+12 -1
View File
@@ -25,6 +25,7 @@ class StructureOptions(TypedDict):
use_database_url: bool
use_tailwind: bool
use_htmx: bool
use_vite: bool
use_github: bool
use_gitlab: bool
@@ -179,6 +180,9 @@ class InputCollector:
def get_htmx_choice(self) -> bool:
return UIFormatter.confirm("Include HTMX? (via django-htmx)", default=True)
def get_vite_choice(self) -> bool:
return UIFormatter.confirm("Include Vite? (via django-vite for frontend bundling)", default=False)
def _get_structure_metadata(self, options: StructureOptions) -> Tuple[str, str, list[str], dict]:
"""Helper method to generate metadata dictionary."""
project_dir = options["project_dir"]
@@ -203,6 +207,7 @@ class InputCollector:
database_type=options["database_type"],
use_tailwind=options.get("use_tailwind", False),
use_htmx=options.get("use_htmx", False),
use_vite=options.get("use_vite", False),
predefined_structure=options["predefined"],
unified_structure=options["unified"],
single_structure=options["single"],
@@ -260,9 +265,10 @@ def get_user_input() -> Tuple[str, str, str, list, dict]:
database_type = collector.get_database_type_choice()
use_database_url = collector.get_database_config_choice()
# Step 3: Tailwind and HTMX
# Step 3: Tailwind, HTMX, and Vite
use_tailwind = collector.get_tailwind_choice()
use_htmx = collector.get_htmx_choice()
use_vite = collector.get_vite_choice()
# Step 3: Django Apps (Standard only)
nested = False
@@ -289,6 +295,7 @@ def get_user_input() -> Tuple[str, str, str, list, dict]:
database_type=database_type,
use_tailwind=use_tailwind,
use_htmx=use_htmx,
use_vite=use_vite,
)
return project_dir, project_name, app_names[0], app_names, metadata.to_dict()
else:
@@ -302,6 +309,7 @@ def get_user_input() -> Tuple[str, str, str, list, dict]:
use_database_url=use_database_url,
use_tailwind=use_tailwind,
use_htmx=use_htmx,
use_vite=use_vite,
use_github=use_github,
use_gitlab=use_gitlab,
)
@@ -340,6 +348,9 @@ def confirm_setup(project_dir: str, project_name: str, app_names: list, metadata
use_htmx = "Yes" if metadata.get("use_htmx", False) else "No"
console.print(f"[{UIColors.HIGHLIGHT}]HTMX:[/{UIColors.HIGHLIGHT}] {use_htmx}")
use_vite = "Yes" if metadata.get("use_vite", False) else "No"
console.print(f"[{UIColors.HIGHLIGHT}]Vite:[/{UIColors.HIGHLIGHT}] {use_vite}")
console.print()
UIFormatter.print_separator()
console.print()
+3 -1
View File
@@ -46,9 +46,10 @@ class DjangoHelper:
"database_type": metadata.get("database_type", "postgresql"),
"use_tailwind": metadata.get("use_tailwind", False),
"use_htmx": metadata.get("use_htmx", False),
"use_vite": metadata.get("use_vite", False),
}
dev_context = {"secret_key": secret_key}
dev_context = {"secret_key": secret_key, "use_vite": metadata.get("use_vite", False)}
# Production context also needs database info
prod_context = base_context.copy()
@@ -64,6 +65,7 @@ class DjangoHelper:
"url_type": "project",
"project_name": project_name,
"django_version": DjangoHelper.DJANGO_VERSION,
"use_tailwind": metadata.get("use_tailwind", False),
}
project_files = [
("urls.py", "config/urls.py-tpl", urls_context),
Generated
+1 -1
View File
@@ -43,7 +43,7 @@ wheels = [
[[package]]
name = "djinitx"
version = "0.3.3"
version = "0.3.7"
source = { editable = "." }
dependencies = [
{ name = "questionary" },