Cli Reference



iktomi.cli.base.manage(commands, argv=None, delim=':')

Parses argv and runs neccessary command. Is to be used in file.

Accept a dict with digest name as keys and instances of Cli objects as values.

The format of command is the following:

./ digest_name:command_name[ arg1[ arg2[...]]][ --key1=kwarg1[...]]

where command_name is a part of digest instance method name, args and kwargs are passed to the method. For details, see Cli docs.


class iktomi.cli.base.Cli

Base class for all command digests

__call__(command_name, *args, **kwargs)
description(argv0='', command=None)

Description outputed to console

class iktomi.cli.lazy.LazyCli(func)

Wrapper for creating lazy command digests.

Sometimes it is not needed to import all of application parts to start a particular command. LazyCli allows you to define all imports in a function called only on the command:

def db_command():
    import admin
    from admin.environment import db_maker

    from models import initial
    from iktomi.cli import sqla
    return sqla.Sqla(db_maker, initial=initial.install)

# ...

def run(args=sys.argv):
    manage(dict(db=db_command, ), args)

Development Server

class, shell_namespace=None, extra_files=None, bootstrap=None)

Development application

  • app – iktomi app
  • shell_namespace – dict with initial namespace for shell command
  • extra_files – extra files to watch and reload if they are changed
  • bootstrap – bootstrap function before called dev server is being runned
command_serve(host='', port='8000', level='debug')

Run development server with automated reload on code change:

./ app:serve [host] [port] [level]

Shell command:

./ app:shell

Executed with self.shell_namespace as local variables namespace.

FCGI Server

class iktomi.cli.fcgi.Flup(app, bind='', logfile=None, pidfile=None, cwd='.', umask=2, fastcgi_params=None)

Flup FastCGI server

  • app – iktomi app
  • bind – socket file
  • logfile – log file
  • pidfile – PID file
  • cwd – current working directory
  • umask
  • fastcgi_params (dict) – arguments accepted by flup WSGIServer, plus preforked

Start a server:

./ flup:start [--daemonize]

Stop a server:

./ flup:stop