UsageΒΆ

Both the dja_skel and the skel management command provide the same command line interface. The --help command displays a short help.

(dja_skel)$ dja_skel --help
Usage: dja_skel [options]

Options:
  --describe            Describe a template in depth.
  -l, --list-templates  Display a list of available templates.
  --list-variables      List template variables.
  -i, --instantiate     Instantiate a template.
  -t TEMPLATE, --template=TEMPLATE
                        Specifies a template name.
  --encoding=ENCODING   Encoding used for output files.
  -h, --help            show this help message and exit

The --encoding switch is intended to specify the encoding used by generated python modules. It defaults to the system encoding currently in use.

The --template switch specifies the template we want to work with.

The --list-templates command displays the available templates:

(dja_skel)$ dja_skel --list-templates
List of available skeletons:
* project13: Skeleton for a django <= 1.3 project
* project14: Skeleton for a django >= 1.4 project

(dja_skel)$ ./manage.py skel --list-templates
List of available skeletons:
* app        : Skeleton for a django app.
* list_view  : Skeleton that creates a CBV list view.
* model      : Creates a model and a model admin
* update_view: Skeleton that creates a CBV update view.

In order to instantiate an skeleton some context data is required. The --list-variables command will display the list of variables required by a given template:

(dja_skel)$ ./manage.py skel --list-variables --template model
List of variables 'model':
  applabel
  ModelName

The value for each variable is specified using the syntax varname=value. Case is significant in variable names.

Once we have the template and the variables it requires we can instantiate it using the --instantiate command:

(dja_skel)$ ./manage.py skel -i -t model applabel=myapp ModelName=MyModel

The --describe command is intended for developers that want to get in depth information about a template. It provides detailed information about a template, the templates it inherits from and the templates it is build upon. The actual information that’s displayed will depend on the template, ideally it should include a description of the layout, required variables, computed variables and markers.

Project Versions

Previous topic

Tutorial

Next topic

Adapting existing code

This Page