🔐 Django Create Initial User
Effortless superuser creation for Django projects
Skip the hassle of python manage.py createsuperuser and jump straight into development!
🚀 Quick Start • 📖 Documentation • 🔧 Installation • 🤝 Contributing
🌟 Why Django Create Initial User?
✨ Features That Make You Go "Wow!"
| 🎯 Smart Creation | 🛡️ Security First | 🔧 Zero Config | 🧪 Battle Tested |
|---|---|---|---|
| Only creates superuser when none exist | DEBUG-mode only by default | Works out of the box | 100% test coverage |
| Auto-detects email usernames | Proper password hashing | No database changes | Supports Django 3.2-5.0 |
| Transparent warning system | Production-safe defaults | Type-hinted codebase | Python 3.9-3.12 ready |
🚀 Quick Start
📦 Installation
# Using pip
pip install django-create-initial-user
# Using uv (recommended)
uv add django-create-initial-user
# Using poetry
poetry add django-create-initial-user
⚙️ Configuration
Add to your Django settings.py:
# Add to INSTALLED_APPS
INSTALLED_APPS = [
# ... your apps
'create_initial_superuser',
]
# Configure authentication backend
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
]
# 🔥 The magic happens here!
if DEBUG:
AUTHENTICATION_BACKENDS.insert(0,
'create_initial_superuser.backends.CreateInitialSuperUserBackend'
)
🎉 Usage
- Start your Django project normally
- Navigate to
/admin/ - Login with ANY credentials you want for your superuser
- ✨ BOOM! You're now logged in as a superuser!
# That's literally it. No manage.py commands needed! 🎊
🎬 See It In Action
sequenceDiagram
participant Dev as 👨💻 Developer
participant Django as 🎯 Django App
participant Backend as 🔐 Auth Backend
participant DB as 🗄️ Database
Dev->>Django: Navigate to /admin/
Django->>Dev: Show login form
Dev->>Django: Submit credentials (admin/secret123)
Django->>Backend: authenticate(admin, secret123)
Backend->>DB: Check for superusers
DB->>Backend: No superusers found!
Backend->>DB: Create superuser(admin, secret123)
DB->>Backend: ✅ Superuser created
Backend->>Django: Return authenticated user
Django->>Dev: 🎉 Welcome to Django Admin!
The entire flow happens transparently - no manual steps required!
📊 Comparison Matrix
| Feature | Manual createsuperuser | Fixtures | Django Create Initial User |
|---|---|---|---|
| 🚀 Zero Setup Time | ❌ | ⚠️ | ✅ |
| 🔄 Works Every Time | ❌ | ⚠️ | ✅ |
| 🛡️ Production Safe | ✅ | ⚠️ | ✅ |
| 🎯 Custom Credentials | ✅ | ❌ | ✅ |
| 📧 Smart Email Detection | ⚠️ | ❌ | ✅ |
| 🧪 Test Friendly | ❌ | ✅ | ✅ |
| 🔧 No Database Changes | ✅ | ❌ | ✅ |
🎯 Perfect For
🛡️ Security Features
# 🔒 Built-in Security Measures
✅ DEBUG mode only by default
✅ Proper password hashing (Django's make_password)
✅ Transparent operation (warning messages)
✅ No backdoors or hardcoded credentials
✅ Production deployment warnings
✅ Comprehensive security documentation
🚨 Security Note: This package is designed for development environments. While it can be used in production for initial deployment, we recommend removing it from
AUTHENTICATION_BACKENDSafter creating your production superuser.
📚 Documentation
| 📖 Guide | 🔗 Link | 📝 Description |
|---|---|---|
| 🚀 Quick Start | Getting Started | Get up and running in 2 minutes |
| ⚙️ Configuration | Settings Guide | Advanced configuration options |
| 🛡️ Security | Security Guide | Best practices and considerations |
| 🔌 API Reference | API Docs | Complete API documentation |
| 🐛 Troubleshooting | FAQ | Common issues and solutions |
| 🤝 Contributing | Contributing Guide | Help make this package better |
🎨 Advanced Usage
🔧 Custom Configuration Examples
Production-Ready Setup
# settings.py
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
]
# Only enable in development
if DEBUG or os.getenv('ENABLE_INITIAL_SUPERUSER'):
AUTHENTICATION_BACKENDS.insert(0,
'create_initial_superuser.backends.CreateInitialSuperUserBackend'
)
Docker Compose Integration
# docker-compose.yml
services:
web:
build: .
environment:
- DEBUG=True
- ENABLE_INITIAL_SUPERUSER=1
ports:
- "8000:8000"
Custom User Model Support
# models.py
from django.contrib.auth.models import AbstractUser
class CustomUser(AbstractUser):
email = models.EmailField(unique=True)
# The backend automatically works with any user model! 🎉
🧪 Testing & Quality
# Run the comprehensive test suite
git clone https://github.com/rsp2k/django-create-initial-user.git
cd django-create-initial-user
# Quick test (using our dev script)
python dev-test.py
# Full test matrix (all Python/Django versions)
tox
# Security scan
make security
📊 Test Coverage
- ✅ 100% line coverage across all modules
- ✅ Edge case testing (missing credentials, DEBUG=False, etc.)
- ✅ Security validation (password hashing, warning messages)
- ✅ Integration testing with Django's auth system
- ✅ Multi-version compatibility testing
🚀 Performance & Compatibility
🐍 Python Support
🎯 Django Support
🤝 Contributing
Love this project? Here's how you can help! 💖
💻 Development Setup
# 🚀 Quick development setup
git clone https://github.com/rsp2k/django-create-initial-user.git
cd django-create-initial-user
# Option 1: Automated setup (recommended)
make dev-setup
# Option 2: Manual setup with uv
uv venv # Creates .venv virtual environment
uv pip install -e ".[dev]" # Install with dev dependencies
uv run pre-commit install # Install git hooks
# Option 3: Complete pre-commit setup with validation
python setup-precommit.py # Interactive setup and validation
# Run tests and quality checks
make test # Or: python dev-test.py
make lint # Or: uv run pytest tests/
# You're ready to contribute! 🎉
🏆 Recognition & Stats
📈 Downloads
|
🌟 Community
|
🔄 Activity
|
🎊 Success Stories
"This package saved me hours of setup time during a 48-hour hackathon. Absolute game-changer!"
— Sarah Chen, Full-Stack Developer
"We use this in all our Django training courses. Students can focus on learning Django instead of admin setup."
— Dr. Rodriguez, Computer Science Professor
"Perfect for our Docker-based CI/CD pipeline. No more interactive superuser creation breaking our builds!"
— Mike Thompson, DevOps Engineer
📄 License & Legal
This project is licensed under the MIT License - see the LICENSE file for details.
© 2025 Django Create Initial User Contributors
🔗 Links & Resources
| 🌐 Resource | 🔗 Link |
|---|---|
| 📦 PyPI Package | pypi.org/project/django-create-initial-user |
| 📖 Documentation | docs.django-create-initial-user.com |
| 🐛 Issue Tracker | GitHub Issues |
| 💬 Discussions | GitHub Discussions |
| 📧 Email Support | support@django-create-initial-user.com |
Metadata
Release files for django-create-initial-user 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_create_initial_user-1.2.3.tar.gz | 15.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_create_initial_user-1.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.2 kB
Release files / django_create_initial_user-1.2.3.tar.gz
| Download URL | django_create_initial_user-1.2.3.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c3f66c2ef948b357218f69c70ed335ba730acc8169ccdd7bbd940af57f695a3
|
|
BLAKE2b-256 checksum How to use checksums |
06d492e30255df07417f4c534b6d3154afddfacdee37ca7baf75545b11c61809
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2025.
Transparency logRelease files / django_create_initial_user-1.2.3-py3-none-any.whl
| Download URL | django_create_initial_user-1.2.3-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87d3b97e01da4d14b349bd0312b3d456391e184a67f38b2d4ae7b8e41a71b61f
|
|
BLAKE2b-256 checksum How to use checksums |
8954d6488879d6f7c2aa42bb8383cc9ba671b48f2e49ba8cfcad7c9db433b217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2025.
Transparency logSecurity for django-create-initial-user 1.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for django_create_initial_user-1.2.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.