Skip to main content

Dev-time conveniences for Django projects: autologin endpoint, dotfiles for LLM agents, gitignore self-check

Project description

django-dev-helpers

CI License: MIT Python Django

Dev-time conveniences for Django projects: autologin endpoint, dotfiles for LLM coding agents, agent help prompt, and gitignore self-check.

Features

  • Autologin endpoint — one URL logs in a user via token, no interactive login needed
  • Dotfiles.dev_helpers_token, .dev_helpers_port, .dev_helpers_pg_*, .dev_helpers_redis_* written to project root for easy cat by LLM agents
  • Agent help prompt — copy-pasteable curl/psql/redis-cli commands printed at startup
  • Gitignore self-check — warns if dotfiles are not in .gitignore
  • Browser auto-open — opens autologin URL in browser after server starts
  • Production-safe — default-off, requires explicit enabled=True, raises on DEBUG=False

Installation

pip install django-dev-helpers
# or
uv add django-dev-helpers --group dev

Quick Start

  1. Add to INSTALLED_APPS:
INSTALLED_APPS = [
    # ...
    "django_dev_helpers",
]
  1. Enable in settings:
DJANGO_DEV_HELPERS = {"enabled": True}

Or via environment variable:

DJANGO_DEV_HELPERS_ENABLED=1 python manage.py runserver
  1. Add URL patterns in your urls.py:
from django_dev_helpers.urls import autologin_urlpatterns

urlpatterns = [
    *autologin_urlpatterns(),
    # ... your other URLs
]

That's it. On startup, the package will:

  • Generate an autologin token
  • Write dotfiles to your project root
  • Check .gitignore
  • Print agent help after first request
  • Open browser with autologin URL

Usage

Autologin

T=$(cat .dev_helpers_token)
curl -L "http://localhost:8000/__autologin__/?token=$T"

Management Commands

python manage.py dev_helpers_doctor          # Full diagnostic
python manage.py dev_helpers_print_help      # Print agent prompt
python manage.py dev_helpers_check_gitignore # Check .gitignore entries

Documentation

Configuration

All configuration via settings.DJANGO_DEV_HELPERS dict. See configuration docs for full reference.

DJANGO_DEV_HELPERS = {
    "enabled": True,
    "autologin": {
        "user_lookup_field": "username",
        "user_lookup_value": "admin",
        "url_path": "__autologin__/",
        "redirect_to": "/",
    },
    "dotfiles": {
        "enabled": True,
    },
    "agent_help": {
        "auto_print": True,
    },
    "browser_open": {
        "enabled": True,
    },
    "gitignore": {
        "mode": "warn",  # warn | auto-add | error | off
    },
}

Security

This package exposes an autologin backdoor for development. It is always off by default:

  • enabled must be explicitly set to True (via settings or env var)
  • Raises ImproperlyConfigured if DEBUG=False and serving HTTP
  • Autologin view verifies token via hmac.compare_digest (timing-safe)
  • Only accepts requests from localhost/127.0.0.1 by default
  • Returns 404 (not 403/401) on any failure — endpoint appears non-existent

Never install this package in production. Add it only to dev dependencies.

Requirements

  • Python >= 3.11
  • Django >= 4.2

Supported versions

Combinations exercised on every push by the CI matrix (.github/workflows/ci.yml):

Python 3.11 Python 3.12 Python 3.13
Django 4.2
Django 5.0
Django 5.1
Django 5.2
Django 6.0

Django 6.0 requires Python ≥ 3.12, so the (3.11, 6.0) cell is excluded from CI.

License

MIT

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_dev_helpers-0.1.2.tar.gz (83.4 kB view details)

Uploaded Source

Built Distribution

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

django_dev_helpers-0.1.2-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file django_dev_helpers-0.1.2.tar.gz.

File metadata

  • Download URL: django_dev_helpers-0.1.2.tar.gz
  • Upload date:
  • Size: 83.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for django_dev_helpers-0.1.2.tar.gz
Algorithm Hash digest
SHA256 857dcb6718d658ef3cf26e02eacf33a32b4bda5dbd8c4d417c656b47cfd9c6d4
MD5 feb7c71c63eb40c701844431b0ab5f0e
BLAKE2b-256 bf8b138d6c2447123ec9c62fcc81b09d37872ee62722016bc095187c86d11c4a

See more details on using hashes here.

File details

Details for the file django_dev_helpers-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_dev_helpers-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad7daeea85c0b4da170ee818cb0fbc7d78c30b746950eb773a6e73f39225a7cb
MD5 f1534ff3a53485020ac77021b1eab981
BLAKE2b-256 b6c379db0a36c765323089e969c7127b20bde7e7a6ab31c56c76b234ecf5953a

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