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 your settings.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

django_docker_helpers.management.run_gunicorn(application, gunicorn_module_name='gunicorn_prod')[source]

Runs gunicorn with a specified config.

Parameters
  • application (WSGIHandler) – Django uwsgi application

  • gunicorn_module_name (str) – gunicorn settings module name

Returns

Application().run()