Commands added to Paster ======================== 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: .. code-block :: bash $ paster model [--no-test] Creates a skeleton Python module, ``.py``, in the model directory of your Shabti application. In addition, a corresponding skeleton unit test module, ``test.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. .. code-block :: bash $ 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. :file:`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 :file:`__init__.py` file of the project's model package. An example: .. code-block :: bash 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 :file:`websetup.py` file of the application) after the tables have been created. .. code-block :: bash $ 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. .. code-block :: bash $ 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. .. code-block :: bash $ paster runner --create Creates a skeleton Python script, ``.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. .. code-block :: bash $ paster runner 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. :file:`development.ini`) is mandatory.