Skip to main content

Convention over configuration for Django - Rails-like scaffolding and generators

Project description

djx-cli

Convention over configuration for Django. Rails-like scaffolding and generators.

Installation

pip install djx-cli

Quick Start

# Create new project (venv, Django, git - all automatic)
djx new myproject
cd myproject
source venv/bin/activate

# Generate full CRUD
djx scaffold Post title:string content:text published:boolean

# Run migrations
python manage.py makemigrations && python manage.py migrate

# Start server
python manage.py runserver

Visit: http://127.0.0.1:8000/posts/

Commands

Project Management

djx new myproject              # Create new Django project with venv, git
djx routes                     # Display all URL routes

Generators

djx scaffold Post title:string body:text published:boolean
djx scaffold Comment post:references author:string content:text
djx model User email:email name:string age:integer
djx controller Post
djx migration add_index_to_posts

Destroy

djx destroy scaffold Post      # Remove app, URLs, settings entry
djx destroy model Post         # Remove model only
djx destroy controller Post    # Remove views/templates only

Configuration

djx config DEBUG False
djx config ALLOWED_HOSTS '["localhost", "127.0.0.1"]'
djx add django-crispy-forms    # Install + add to INSTALLED_APPS

Field Types

  • string → CharField
  • text → TextField
  • integer → IntegerField
  • boolean → BooleanField
  • date → DateField
  • datetime → DateTimeField
  • decimal → DecimalField
  • email → EmailField
  • url → URLField
  • references:Model → ForeignKey

Example Workflow

# Create project
django-admin startproject myproject
cd myproject

# Generate scaffold
djx scaffold Article title:string content:text published:boolean

# Run migrations
python manage.py makemigrations
python manage.py migrate

# Start server
python manage.py runserver

Visit: http://localhost:8000/articles/

Architecture

Trade-offs:

  • ✓ Faster development, less boilerplate
  • ✓ Consistent structure across projects
  • ✗ Less explicit than pure Django
  • ✗ Opinionated URL patterns

Conventions:

  • Auto-creates app if missing (pluralized model name)
  • Auto-wires URLs to project
  • Auto-adds apps to INSTALLED_APPS
  • CRUD views use class-based views
  • Templates follow app/model_action.html pattern

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

djx_cli-0.1.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djx_cli-0.1.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file djx_cli-0.1.1.tar.gz.

File metadata

  • Download URL: djx_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for djx_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 eb9d688546f8ca012a403a4b5d9c6368ceb9b557fe570a9f3d386e645389a558
MD5 fbf30ca0bede6983688446e7b3fcd2cd
BLAKE2b-256 31ddbfd0d75172e240d0eb7177f78d76e4fcac14e73f1f274e09b7920c2e0054

See more details on using hashes here.

File details

Details for the file djx_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: djx_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for djx_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2337923c17ca81f6be99d19067f7a16d47291eab381f9f6012591d1bb8261987
MD5 8906e7a5e1131991ce3275b857d54766
BLAKE2b-256 188d802c69fbdc8ab50b3e46c0fb97ff8ac6c1e58c4f9f9f71c716d0603a1cf5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page