Create a superuser if it doesn't exist, in the non interactive mode, using environment variables to set the email and password
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_ensuresuperuser-0.1.1.tar.gz.
File metadata
- Download URL: django_ensuresuperuser-0.1.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8655ca8447cd674b32cfe6eb4ade339a8e480ee80a599ecb61592f02527b583
|
|
| MD5 |
a50e213e792d90d618a02e5a92ad30cc
|
|
| BLAKE2b-256 |
243d73344d7cda1839a6a817df3dfa63d65afcc9adc74990fd4a2deec27d7bbc
|
Provenance
The following attestation bundles were made for django_ensuresuperuser-0.1.1.tar.gz:
Publisher:
python-package.yml on ChrisW-priv/django_ensuresuperuser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_ensuresuperuser-0.1.1.tar.gz -
Subject digest:
a8655ca8447cd674b32cfe6eb4ade339a8e480ee80a599ecb61592f02527b583 - Sigstore transparency entry: 469200216
- Sigstore integration time:
-
Permalink:
ChrisW-priv/django_ensuresuperuser@1a77c322f7c86b2b352ba802fb9e31fabbead787 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ChrisW-priv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@1a77c322f7c86b2b352ba802fb9e31fabbead787 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_ensuresuperuser-0.1.1-py3-none-any.whl.
File metadata
- Download URL: django_ensuresuperuser-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a2c8a821bdd45aabf782c92de2ece819eb574d22a04454bd357a996009b23fe
|
|
| MD5 |
76d8992ba4e06892dd1763aa24384ebd
|
|
| BLAKE2b-256 |
7d65d8204434b0fc43c3432638ea413b19c87c829e9124db54c8c8b2f0f7bb0b
|
Provenance
The following attestation bundles were made for django_ensuresuperuser-0.1.1-py3-none-any.whl:
Publisher:
python-package.yml on ChrisW-priv/django_ensuresuperuser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_ensuresuperuser-0.1.1-py3-none-any.whl -
Subject digest:
0a2c8a821bdd45aabf782c92de2ece819eb574d22a04454bd357a996009b23fe - Sigstore transparency entry: 469200219
- Sigstore integration time:
-
Permalink:
ChrisW-priv/django_ensuresuperuser@1a77c322f7c86b2b352ba802fb9e31fabbead787 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/ChrisW-priv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@1a77c322f7c86b2b352ba802fb9e31fabbead787 -
Trigger Event:
release
-
Statement type: