Shabti uses the paster command line tool that comes with Paste. Most of the common paster commands are explained in the Pylons documentation. Shabti adds some extra commands of its own, mainly for database management:
$ paster model <model_name> [--no-test]
Creates a skeleton Python module, <model_name>.py, in the model directory of your Shabti application. In addition, a corresponding skeleton unit test module, test<model_name>.py, is added to the tests/unit directory of your Shabti package, along with a directory for storing your test fixtures and other fixtures. If the --no-test flag is passed then the test files are not created.
$ paster create_sql [--table=table] [--setup] config-file
Creates all tables (i.e. CREATE TABLE) based on available model classes. The config-file argument is always required, e.g. development.ini. You must provide the correct URI to your database in the configuration setting sqlalchemy.default.uri (see (LINK) for the correct URI for your database vendor).
Note that for a model class to be “visible” to the database commands, it has to be imported in the __init__.py file of the project’s model package. An example:
from mymodel import MyModel
Optionally, the name of a single table can be passed to create_sql with the --table argument. Adding the --setup flag will run setup-app (i.e. the websetup.py file of the application) after the tables have been created.
$ paster drop_sql [--table=table] config-file
Drops all available tables (i.e. DROP TABLE), or a single named table if given in the --table argument.
$ paster reset_sql [--table=table] [--setup] config-file
Drops all available classes and then re-creates them (or single table given in --table argument). As with create_sql, including the --setup flag causes websetup.py to be executed.
$ paster runner --create <script_name>
Creates a skeleton Python script, <script_name>.py, in the scripts directory of the Shabti application package. This script is used for running background tasks outside the web application, with cron for example.
$ paster runner <script-name> config-file
Runs a script that was created with runner --create. This command can be used with cron for running repetitive or timed tasks. A config-file argument (e.g. development.ini) is mandatory.