Skip to main content

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

Project description

djx

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

Installation

pip install -e .

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.0.tar.gz (11.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.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djx_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 11.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.0.tar.gz
Algorithm Hash digest
SHA256 f10f002fb067d1126294d325e41c5b31432724f04e7242016a6259c35e0d1099
MD5 688a946a88aaeff26925de4a9f2a9b61
BLAKE2b-256 e107ee8ddb37c623de56e10128911ad7199472588f6c409cb1097395e45b5206

See more details on using hashes here.

File details

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

File metadata

  • Download URL: djx_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4eb18769bdff33a7b9b1eedd6abeab9401df26c92f13e2baee5cef80efc4f8d
MD5 352a1a7f0ad5dd87da4f197d188ab764
BLAKE2b-256 f3f4699bd9f97cf5c125240e519f556cf6dc3c6d60ddc53437b4f9b3fb66fcaf

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