Management¶
- django_docker_helpers.management.create_admin(user_config_path='CONFIG.superuser')[source]¶
Creates a superuser from a specified dict/object bundle located at
user_config_path
. Skips if the specified object contains no email or no username. If a user with the specified username already exists and has no usable password it updates user’s password with a specified one.user_config_path
can accept any path to a deep nested object, like dict of dicts, object of dicts of objects, and so on. Let’s assume you have this weird config in yoursettings.py
:class MyConfigObject: my_var = { 'user': { 'username': 'user', 'password': 'qwe', 'email': 'no@example.com', } } local_config = MyConfigObject()
To access the
'user'
bundle you have to specify:local_config.my_var.user
.- Parameters
user_config_path (
str
) – dot-separated path to object or dict, default is'CONFIG.superuser'
- Return type
bool
- Returns
True
if user has been created,False
otherwise