demosys.core.management package

Submodules

demosys.core.management.base module

class demosys.core.management.base.BaseCommand

Bases: object

add_arguments(parser)

This method is for adding arguments to a command. When extending this class we define the arguments by adding it to the parser passed in.

Parameters:parser – The parser to add arguments to (standard argparse)
create_parser(prog_name, subcommand)

Create argument parser and deal with add_arguments. This method should not be overriden.

Parameters:prog_name – Name of the command (argv[0])
Returns:ArgumentParser
handle(*args, **options)

The actual run logic for the command.

Parameters:
  • args – arguments from the argparser
  • options – keyword arguments from the argparser
help = ''
print_help(prog_name, subcommand)

Prints the help text generated by the argument parser defined for this command. This method should not be overridden.

Parameters:
  • prog_name – name of the program that started the command.
  • subcommand – The subcommand name
run_from_argv(argv)

Called by the system when executing the command from the command line. This should not be overridden.

Parameters:argv – Arguments from command line
exception demosys.core.management.base.CommandError

Bases: Exception

class demosys.core.management.base.CreateCommand

Bases: demosys.core.management.base.BaseCommand

Used for createproject and createeffect

try_import(name)

Attempt to import the name. Raises ImportError if the name cannot be imported.

Parameters:name – the name to import
validate_name(name)

Can the name be used as a python module or package? Raises ValueError if the name is invalid.

Parameters:name – the name to check

Module contents

demosys.core.management.execute_from_command_line(argv=None)

Currently the only entrypoint (manage.py, demosys-admin)

demosys.core.management.find_commands(command_dir)

Get all command names in the command folder :return: List of commands names

demosys.core.management.load_command_class(app_name, name)
demosys.core.management.local_command_dir()
demosys.core.management.project_command_dir()
demosys.core.management.project_package_name()
demosys.core.management.project_settings_path()