Skip to main content

A CLI tool to bootstrap a production-ready Django REST Framework project in seconds.

Project description

Django Shortcut (django-shortcut)

PyPI version Python versions License: MIT

A powerful, light-weight Command-Line Interface (CLI) tool to bootstrap a production-ready Django REST Framework (DRF) project in seconds.

This tool automates the tedious setup tasks—such as configuring virtual environments, installing dependencies, writing .env files, setting up CORS, and configuring JSON Web Token (JWT) authentication—so you can focus on writing your API endpoints immediately.


🚀 Features

  • 🐍 Automatic Virtual Environment (venv): Installs, configures, and upgrades pip, setuptools, and wheel inside the local environment.
  • 📦 Pre-configured Dependencies: Installs django, djangorestframework, djangorestframework-simplejwt, django-cors-headers, django-environ, and pillow automatically.
  • ⚙️ Production-Ready settings.py: Out-of-the-box support for .env loading, CORS configuration, database connection environment variables, and media/static root configurations.
  • 🔐 Pre-configured JWT Auth: Pre-integrated JWT auth settings using djangorestframework-simplejwt.
  • 🔧 Git Integration: Initializes a Git repository and writes a comprehensive .gitignore file.
  • 🐳 Dependency Locking: Auto-generates a requirements.txt file based on the local virtualenv state.
  • 📚 Tailored Documentation: Generates a project-specific README.md inside your new project folder with instructions to run and scale.

📋 Requirements

  • Python: Version 3.8 or higher
  • Git: Installed and configured (optional, for repository initialization)

⚙️ Installation

Install the package directly from PyPI:

pip install django-shortcut

To verify the installation:

dj-shortcuts --help

🛠️ Usage & Quick Start

Create a new Django REST Framework project using a single command:

dj-shortcuts <project_name>

Examples

Basic Project Initialization:

dj-shortcuts ecommerce_api

Generate Project in a Custom Directory:

dj-shortcuts ecommerce_api --target C:\Projects\ecommerce_api

(or use the shorthand: -t C:\Projects\ecommerce_api)


💡 Alternative Invocation (Windows PATH Troubleshooting)

If you get an error saying 'dj-shortcuts' is not recognized as an internal or external command, it means Python's user scripts folder is not in your system PATH variable.

You can run the generator module directly using Python without changing system variables:

python -m django_shortcuts.cli <project_name>

Example:

python -m django_shortcuts.cli ecommerce_api

📁 Generated Project Structure

When you create a project, the following directory tree is generated:

my_project_name/
├── venv/                 # Python Virtual Environment
├── my_project_name/      # Django Settings Directory
│   ├── __init__.py
│   ├── asgi.py
│   ├── settings.py       # Fully preconfigured DRF/JWT settings
│   ├── urls.py           # Preconfigured with static/media routing
│   └── wsgi.py
├── .env                  # Pre-populated secret key & db environment variables
├── .gitignore            # Complete Python and Django Git excludes
├── manage.py
├── requirements.txt      # Installed dependencies pinned versions
└── README.md             # Running instructions specific to your project

🏃‍♂️ Step-by-Step Post-Creation Guide

Once your project is created, follow these steps to run your development server:

1. Navigate to the project directory

cd ecommerce_api

2. Activate the virtual environment

  • On Windows (PowerShell):
    venv\Scripts\Activate.ps1
    
  • On Windows (CMD):
    venv\Scripts\activate.bat
    
  • On macOS/Linux:
    source venv/bin/activate
    

3. Start the Development Server

python manage.py runserver

Now, visit:

4. Create a Superuser

To log in to the admin panel, create a new administrative user:

python manage.py createsuperuser

👤 Author & Support

Developed with ❤️ by Mahedi Hasan Noyon.

If you find this tool helpful, please give a ⭐️ to the GitHub Repository!

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

django_shortcut-0.1.5.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

django_shortcut-0.1.5-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file django_shortcut-0.1.5.tar.gz.

File metadata

  • Download URL: django_shortcut-0.1.5.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for django_shortcut-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f789d7b57e3b211ff432dd2cd639312b0493426eaf4286434844beb94f20cde4
MD5 1324ec5047cc0d481fe268d8031b9c91
BLAKE2b-256 717ff71a10861f5dc331025ca3bc30004f0c6fac837f081720b3e48488400f26

See more details on using hashes here.

File details

Details for the file django_shortcut-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_shortcut-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8958e07120f2bf243e50717a7b30e36cb01cebe688f9fb59ce89b0623c7cf772
MD5 8309c6b03b0b8bb129a16cfa913c25cb
BLAKE2b-256 24b4e2e56d3e0526df20f9c748104f4e2c0a50f359ad49cb462a81ff98c4c772

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