Management commands#

This document describes the available management commands that can be used to manage your local Konfuzio server. These commands can be executed from the command line and allow you to perform a variety of administrative tasks.

To view a list of the available management commands, run:

python help

To view the help for a specific command, run:

python <command> --help or python <command> -h


Check Document integrity for the provided project/s.

Argument: project_id

Project ids to check separated by space.

python check_docs <project_id> <project_id> ...


Hard delete deleted Documents which are older than the specified amount of days.

Argument: days

Documents older than this amount of days will be deleted.

python clean_deleted <days>


Delete existing Annotation Sets which have no Annotations or Extractions associated. Useful to clean up superfluous data after an upgrade or other manual operations.

Optional argument: –project

The Project ID to consider. If not specified, all Projects are considered.

Optional argument: –delete

If not present, the command only shows Annotation Sets instead of deleting them.

python delete_empty_annotation_sets --project 1 --delete


Create a dependency graph for full_document_workflow and save it to file. This can then be converted to a png using dot -Tpng -o graph.png

python draw


Dump FileFields and ImageFields locally.

Argument: objects

Choose between “document” or “ai” to dump the corresponding object_id.

Argument: object_id

The ID of the Document or AI to fix.

python dump_storage document 1
python dump_storage ai 1

Output of dump_storage is either in document_dump.log or ai_dump.log depending on the argument.


Finds and optionally fixes Annotations where the start_offset and end_offset are not consistent with the bboxes. It uses the data from the bboxes.

Optional argument: –fix

If specified, will fix all Annotations instead of just printing them.

python fix_annotation_offsets --fix


Assert that every necessary email_template is present.

python init_email_templates


Assert that every user has the default permissions.

python init_user_permissions


This command creates a demo database for local debugging, as it is used in our django client tests.

python make_demo_db

If the command was already run, do python flush to reset the database.


This command creates a database for public debugging.

python make_public_demo_db

If the command was already run, do python flush to reset the database.


Rebuilds the name (verbose text) for all default permissions.

python rebuild_permission_names


Iterate through each Project with defined auto_delete_documents_after_days and remove for each such Project, Documents without dataset_status that were created auto_delete_documents_after_days days ago.

python remove_documents_without_dataset_by_schedule


Re-save all AIModels using cloudpickle.

python resave_all_with_cloudpickle


Reinstalls the requirements, deletes the database, runs the migrations again and creates the demo database.

python reset


Scan the provided email for new Documents. The environment variable SCAN_EMAIL_RECIPIENT must have a value first.

python scan_email

Management commands that import projects generated by the SDK#


  • SDK has been installed

  • SDK has been initialized via konfuzio_sdk init

  • Project has been created with a document

Export the project via konfuzio_sdk export_project <project_id>. A directory containing the project data will be created. Here is an example of an exported project generated by the SDK:


For the management commands below, the project path that will be passed as an argument is the one that is exported by the SDK.


This command creates a big database for local debugging, as it is used in our django client tests.

Argument: copies

Specify the number of Documents to create

Optional argument: –project

The path to a Project generated by the Konfuzio SDK (otherwise the default one is used).

python make_big_demo_db 1 --project data/big_demo_project


This command imports a Project to a Konfuzio Server instance, given a properly structured project data folder.

Argument: project_path

The path to where the project data resides, relative to where you’re running this command from.

Argument: project_name

The name that you want to give to the new Project. Leave blank and specify –merge-project if you want to merge the data with an existing Project.

Optional argument: –merge-project

If specified, will merge the Project data into the existing Project with the specified ID. If not specified, a new Project will be created.

python project_import <project_path> <project_name> --merge-project <project_id>