A CLI tool to setup Django project
Project description
djinit
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):
pipx install djinitx
Or with pip:
pip install djinitx
Or with uv:
uv tool install djinitx
Requirements: Python 3.13+
Getting Started
Just run:
djinit setup
You can also use the shorter alias:
dj setup
The tool will ask you a few questions:
-
What structure do you want?
- Standard: Classic Django layout with split settings
- Predefined: Organized with
apps/andapi/folders (great for larger projects) - Unified: Everything under
core/andapps/(clean and minimal) - Single Folder: All apps in one configurable folder (simple and flat)
-
Project Setup:
- Where to create it (use
.for current directory) - Project name (or directory name for Single Folder)
- Where to create it (use
-
Database Configuration:
- Use
DATABASE_URL(cleaner, recommended) - Or separate DB variables
- Choose between PostgreSQL or MySQL
- Use
-
Django Apps (Standard Structure only):
- Whether to use an
apps/folder - Which apps to create
- Whether to use an
-
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
Every project includes:
- 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 serving 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
djinit setup
Add Apps to Existing Project
djinit app users products orders
This automatically creates the apps, adds them to INSTALLED_APPS, and wires up URLs.
Generate Secret Keys
djinit secret
Need more? Use --count 5 or change length with --length 64.
Project Structures
Standard Structure
The classic Django layout with split settings:
myproject/
├── manage.py
├── myproject/ # Config module
│ ├── settings/ # Split settings
│ ├── urls.py
│ └── wsgi.py
└── apps/ # Your apps (optional)
└── users/
Single Folder Layout
Simple structure with all apps in one folder:
myproject/
├── manage.py
├── project/ # Configurable folder name
│ ├── settings/
│ ├── urls.py
│ ├── models/ # All models here
│ ├── api/ # API views and serializers
│ │ └── your_model_name/
│ │ ├── views.py
│ │ ├── serializers.py
│ │ └── urls.py
│ └── wsgi.py
Predefined Structure
Organized for larger projects:
myproject/
├── manage.py
├── config/ # Django config
│ ├── settings/
│ └── urls.py
├── apps/ # Business logic
│ ├── users/
│ └── core/
└── api/ # API routes
└── v1/
Unified Structure
Clean and minimal:
myproject/
├── manage.py
├── core/ # Django config
│ ├── settings/
│ └── urls.py
└── apps/ # Main application package
├── admin/
├── models/
├── serializers/
├── views/
├── urls/
└── api/ # API routes
Development Workflow
Your project comes with a Justfile for common tasks:
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
Don't have just installed? No problem—these are just shortcuts for standard Django commands.
What's Included
Packages
- Django (web framework)
- Django REST Framework (API)
- djangorestframework-simplejwt (JWT auth)
- drf-spectacular (API docs)
- django-cors-headers (CORS)
- django-jazzmin (modern admin)
- whitenoise (static files)
- psycopg2-binary (PostgreSQL)
- gunicorn (production server)
- python-dotenv (environment variables)
API Endpoints
/admin/- Django admin/token/- Get JWT token/token/refresh/- Refresh token/docs/- Swagger UI (dev only)/schema/- OpenAPI schema (dev only)
Settings
Development: SQLite, debug mode, console emails, permissive CORS Production: PostgreSQL, security hardened, SMTP emails, strict CORS
Environment Setup
Copy .env.sample to .env and fill in your values:
SECRET_KEY=your-secret-key-here # Use: djinit secret
DATABASE_URL=postgres://user:pass@host:5432/db
ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com
For development, SQLite works out of the box—no database setup needed!
Contributing
Found a bug or have an idea? Open an issue or submit a pull request. Contributions are always welcome!
License
MIT © Sankalp Tharu
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djinitx-0.3.3.tar.gz.
File metadata
- Download URL: djinitx-0.3.3.tar.gz
- Upload date:
- Size: 61.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2765a9404a7d5d5974161f78b47e86d83f47b26444cded4826ecd1fac018438f
|
|
| MD5 |
1723f6f48eef5b81ca46dcd7956bb567
|
|
| BLAKE2b-256 |
23471ca4fba483daaf39342c42826fcfb9ca82c88529234556e006de0551ea0e
|
File details
Details for the file djinitx-0.3.3-py3-none-any.whl.
File metadata
- Download URL: djinitx-0.3.3-py3-none-any.whl
- Upload date:
- Size: 61.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90b29268cf2c7fc658a545634c783029fbdab432361a92eb144a83a49032310e
|
|
| MD5 |
053d4a9360a8d28af0e477a3e6f14046
|
|
| BLAKE2b-256 |
f8f81c6e4a51fc6ecb87876b9b3c2f6801b266bc78c7502fe51da69430cf918c
|