Django Ensure Superuser
A simple Django management command to create a superuser non-interactively if one does not already exist.
This is useful for automating the setup of a Django application, for example, in a Docker container or a deployment script.
Installation
- Install the package using pip:
pip install django-ensuresuperuser
- Add
django_ensuresuperuserto yourINSTALLED_APPSsetting in your Django project'ssettings.py:
INSTALLED_APPS = [
# ...
'django_ensuresuperuser',
]
Usage
Assuming all variables are set, run the management command:
python manage.py ensuresuperuser
Configuration
The command requires the following environment variables to be set:
DJANGO_SUPERUSER_PASSWORD: The password for the superuser.DJANGO_SUPERUSER_EMAIL(optional): The email for the superuser. Defaults toadmin@example.com.
The superuser will be created with the username admin.
If a user with the username admin already exists, the command will do nothing.
Example
export DJANGO_SUPERUSER_PASSWORD="mysecretpassword"
export DJANGO_SUPERUSER_EMAIL="admin@mydomain.com"
python manage.py ensuresuperuser
Metadata
Release files for django-ensuresuperuser 0.1.1
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_ensuresuperuser-0.1.1.tar.gz | 3.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_ensuresuperuser-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / django_ensuresuperuser-0.1.1.tar.gz
| Download URL | django_ensuresuperuser-0.1.1.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8655ca8447cd674b32cfe6eb4ade339a8e480ee80a599ecb61592f02527b583
|
|
BLAKE2b-256 checksum How to use checksums |
243d73344d7cda1839a6a817df3dfa63d65afcc9adc74990fd4a2deec27d7bbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Sep 4, 2025.
Transparency logRelease files / django_ensuresuperuser-0.1.1-py3-none-any.whl
| Download URL | django_ensuresuperuser-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a2c8a821bdd45aabf782c92de2ece819eb574d22a04454bd357a996009b23fe
|
|
BLAKE2b-256 checksum How to use checksums |
7d65d8204434b0fc43c3432638ea413b19c87c829e9124db54c8c8b2f0f7bb0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Sep 4, 2025.
Transparency logSecurity for django-ensuresuperuser 0.1.1
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_ensuresuperuser-0.1.1.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 Sep 4, 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.