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 manage.py help

To view the help for a specific command, run:

python manage.py <command> --help or python manage.py <command> -h

check_docs#

Check Document integrity for the provided project/s.

Argument: project_id

Project ids to check separated by space.

python manage.py check_docs <project_id> <project_id> ...

clean_deleted#

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 manage.py clean_deleted <days>

delete_empty_annotation_sets#

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 manage.py delete_empty_annotation_sets --project 1 --delete

draw#

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

python manage.py draw

dump_storage#

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 manage.py dump_storage document 1
python manage.py dump_storage ai 1

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

fix_annotation_offsets#

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 manage.py fix_annotation_offsets --fix

init_email_templates#

Assert that every necessary email_template is present.

python manage.py init_email_templates

init_user_permissions#

Assert that every user has the default permissions.

python manage.py init_user_permissions

make_demo_db#

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

python manage.py make_demo_db

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

make_public_demo_db#

This command creates a database for public debugging.

python manage.py make_public_demo_db

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

rebuild_permission_names#

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

python manage.py rebuild_permission_names

remove_documents_without_dataset_by_schedule#

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 manage.py remove_documents_without_dataset_by_schedule

resave_all_with_cloudpickle#

Re-save all AIModels using cloudpickle.

python manage.py resave_all_with_cloudpickle

reset#

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

python manage.py reset

scan_email#

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

python manage.py scan_email

Management commands that import projects generated by the SDK#

Prerequisites:

  • 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:

directory_structure.png

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

make_big_demo_db#

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 manage.py make_big_demo_db 1 --project data/big_demo_project

project_import#

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 manage.py project_import <project_path> <project_name> --merge-project <project_id>