Djinit

cover

Building djinit: Let’s Stop Wasting Time on Setup

Let’s be honest. Starting a new Django project is… well, it is kind of a chore. You love Django, I love Django, but setting up the same old folder structure, configuring DRF, and fighting with CORS headers for the 100th time? Not fun.

That is exactly why I built djinit. It started as a personal tool just for me, to stop the boring copy paste cycle and get straight to the coding. Today, I want to share why I built it and how it can make your life easier.

The “Why” Behind the Tool

I built djinit because I was tired. I noticed that every time I started a new idea, I had to do the same manual work:

  1. Split Settings: Creating base.py, dev.py, and prod.py manually.
  2. API Setup: Installing Django REST Framework and setting up all the parsers.
  3. Auth: Wiring up JWT authentication so users can actually log in.
  4. CORS: Fixing those annoying cross origin errors that block the frontend.
  5. Docs: Setting up Swagger so I could see my API endpoints.
  6. Deployment: Writing Procfile and requirements.txt for the server.

I thought, “Why am I doing this by hand?” I wanted a tool that acts like a smart assistant: I answer a few questions, and it builds the perfect foundation for me.

How It Works

Think of djinit as your project architect. It is a Python CLI tool (built with typer and rich) that does the heavy lifting for you.

When you run it, it feels like a conversation:

  1. It Asks: “What structure?”, “Which database?”, “Want Tailwind, HTMX, or Vite?”, “CI/CD pipeline?”
  2. It Builds: It generates all the folders, files, and configurations instantly.
  3. It Prepares: It sets up your dependencies with uv sync or pip install.
  4. It Delivers: You get a project that runs immediately.

What You Get Out of the Box

When you run djinit setup, you don’t just get a blank folder. You get a fully loaded launchpad:

  • Ready to Go Settings: Development and Production settings are already split and configured with # noqa comments so linters don’t complain.
  • API Ready: Django REST Framework is installed and set up with JWT authentication.
  • Auto Documentation: Swagger UI at /docs/ and ReDoc at /schema/ thanks to drf-yasg.
  • No CORS Headaches: Handled for dev and locked down for production.
  • Database Choice: PostgreSQL or MySQL, with DATABASE_URL or individual env vars.
  • Production Ready: WhiteNoise for static files, Gunicorn config, and a Dockerfile included.
  • Dev Tools: A Justfile with common commands, ruff for linting, pytest for testing.
  • CI/CD: GitHub Actions and/or GitLab CI pipelines generated on request.

Optional Add-ons

Beyond the basics, djinit now asks if you want frontend tooling:

  • Tailwind CSS - Scaffolded with django-tailwind-cli, DaisyUI theme, and Node.js install in Docker.
  • HTMX - django-htmx app and middleware wired into your settings.
  • Vite - django-vite with a vite.config.ts, dev/prod mode toggles, and a CI build step.

Pick any combination, or none at all. The wizard handles it.

How to Use It

Getting started is super easy.

A small heads up: I wanted to name the package djinit, but PyPI said that name was taken. So, when you install it, you need to look for djinitx.

pipx install djinitx

# or

uv tool install djinitx

# or

pip install djinitx
Shell

Once installed, you can use the name djinit (or just dj) in your terminal:

djinit setup

# or simply

dj setup
Shell

Pick Your Style

Every project is different, so djinit lets you choose the structure that fits:

  1. Standard: The classic Django layout we all know.
  2. Single Folder: Keep it simple. All your apps live in one folder.
  3. Predefined: Great for bigger projects. It separates apps/ and api/.
  4. Unified: Clean and minimal. Everything lives under core/ and apps/.

Add Apps in a Snap

Need to add a users app or a products app? Don’t create folders manually. Just tell djinit:

djinit app users products
Shell

It creates the apps and here is the best part — it automatically adds them to your INSTALLED_APPS setting and wires up URL includes.

Generate Secret Keys

Need a Django secret key? Don’t search online for random generators:

dj secret
Shell

This generates a secure 50 character secret key. Need more keys or a different length?

dj secret --count 5        # Generate 5 keys
dj secret --length 64      # Generate a 64 character key
dj secret --count 3 --length 32  # 3 keys, each 32 characters
Shell

Important Note: djinit builds the house, but you have to put the furniture in it. It sets up the structure and configuration, but it does not write your business logic, models, or views. That fun part is still all yours!

What’s Changed

Since the initial release, djinit has grown a lot:

  • Docker Support - Auto-generates a Dockerfile with multi-stage builds and Node.js for frontend tools.
  • Frontend Tooling - Tailwind CSS, HTMX, and Vite integration are now live, not just plans.
  • CI/CD Pipelines - GitHub Actions and GitLab CI templates that match your project.
  • Dependency Management - uv native support with pyproject.toml and [dependency-groups].
  • Dev Dependencies - ruff, pytest, and pytest-django included out of the box.
  • API Docs - Switched from drf-spectacular to drf-yasg for a more mature documentation stack.
  • Django 6.0 - Supports Django 5.1, 5.2, and 6.0.

Future Plans

I am not done yet! Here is what is on my wishlist:

  1. Celery Integration: Making background tasks easier to set up.
  2. Frontend Scaffolding: Generating React or Vue starter projects alongside the Django backend, not just config.
  3. More Packages: Integrating other popular packages to help you build feature rich apps effortlessly.

Conclusion

djinit was born from frustration, but it was built with love for the Django community. It removes the boring setup phase so you can focus on what matters: building your application.

Give it a try. If it saves you even 10 minutes of configuration hell, then it did its job.

Happy Coding!