django-createsuperuser
Django app that implements a signal to create super user from environment variables on migration. Useful for Docker, Kubernetes etc. If the user already exists it will do nothing.
Installation
Simply download from Pypi:
pip install django_superuser
Usage
This app needs to register in the INSTALLED_APPS list in your Django settings:
INSTALLED_APPS = [
...
"createsuperuser",
...
]
As it is, it will do nothing. You need to define 4 environment variables through which the superuser will be created during the migration stage (uses the post_migrate signal).
| Environment Variable | Description |
|---|---|
| DJANGO_SUPERUSER_CREATE | Enables the process of creating the superuser. Must be true or false (case insensitive) |
| DJANGO_SUPERUSER_USERNAME | The username of the superuser account to create |
| DJANGO_SUPERUSER_EMAIL | The email of the superuser account |
| DJANGO_SUPERUSER_PASSWORD | The password of the superuser account |
After defining these variables, the superuser will be created the next time you perform a migration (even if no migrations are applied)
export DJANGO_SUPERUSER_CREATE=true
export DJANGO_SUPERUSER_USERNAME=admin
export DJANGO_SUPERUSER_EMAIL=admin@example.com
export DJANGO_SUPERUSER_PASSWORD=admin
python manage.py migrate
You can use this to create the user when launching your django project in Docker
by passing the variables in the command. Or if you are using Kuberenetes you can
add them in a Secret and pass them in the pod via envFrom. Or however the
environment variables fit in your workflow.
Metadata
Release files for django-createsuperuser-signal 0.0.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 | Actions |
|---|---|---|---|---|
| django-createsuperuser-signal-0.0.1.tar.gz | 7.2 kB | Without provenance | Details for django-createsuperuser-signal-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_createsuperuser_signal-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for django_createsuperuser_signal-0.0.1-py3-none-any.whl |
Total release size: 15.6 kB
Release files / django-createsuperuser-signal-0.0.1.tar.gz
| Download URL | django-createsuperuser-signal-0.0.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3955ad4bb14452c0de634b82cf313d694467eb4e71e64bc401ca9cd5fa6e5b4d
|
|
BLAKE2b-256 checksum How to use checksums |
9acb76cbdedb2483b4756a53c184b833fe3da302ff65f825e6a5ddb2ece51839
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10
|
Release files / django_createsuperuser_signal-0.0.1-py3-none-any.whl
| Download URL | django_createsuperuser_signal-0.0.1-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d494df74c620021b3ff94833cae5ce8d54acc9ea080973a8879eb4918dededb
|
|
BLAKE2b-256 checksum How to use checksums |
873334d305d108ca2bf7b11df400ba7f610da61d5de651f5f49412bab13a0f98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10
|
Security for django-createsuperuser-signal 0.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.