Cli Reference¶
Base¶
manage¶
-
iktomi.cli.base.
manage
(commands, argv=None, delim=':')¶ Parses argv and runs neccessary command. Is to be used in manage.py file.
Accept a dict with digest name as keys and instances of
Cli
objects as values.The format of command is the following:
./manage.py 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.
Cli¶
-
class
iktomi.cli.base.
Cli
¶ Base class for all command digests
-
__call__
(command_name, *args, **kwargs)¶
-
description
(argv0='manage.py', 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:
@LazyCli 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
iktomi.cli.app.
App
(app, shell_namespace=None, extra_files=None, bootstrap=None)¶ Development application
Parameters: - 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:
./manage.py app:serve [host] [port] [level]
-
command_shell
()¶ Shell command:
./manage.py 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
Parameters: - 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
-
command_start
(daemonize=False)¶ Start a server:
./manage.py flup:start [--daemonize]
-
command_stop
()¶ Stop a server:
./manage.py flup:stop