Commands

This is a list of available Django commands for content settings.


content_settings_migrate

You can migrate settings updates using this command. It is particularly useful if you have the Django setting CONTENT_SETTINGS_UPDATE_DB_VALUES_BY_MIGRATE=False. (See settings).

$ python manage.py content_settings_migrate

Without arguments, the command does not apply any changes but displays the changes that would be applied.

$ python manage.py content_settings_migrate --apply

Add --apply to apply the changes to the database.


content_settings_export

Export values from the database to STDOUT in JSON format.

$ python manage.py content_settings_export

Without arguments, this command exports all settings.

$ python manage.py content_settings_export > backup.json

Redirect the output to a file to create a complete backup of your settings.

$ python manage.py content_settings_export --names TITLE DESCRIPTION

Export only specific settings. In the example above, only the settings "TITLE" and "DESCRIPTION" are exported.

You can also perform exports through the Django Admin Panel. Read more about it here.


content_settings_import

Import data into the database from a JSON file generated by content_settings_export or the Django Admin UI.

Example Commands:

$ python manage.py content_settings_import file.json

This command does not immediately import data but displays what would be imported, along with any errors.

$ python manage.py content_settings_import file.json --show-only-errors

Use this option to display only errors, skipping valid or approved records.

$ python manage.py content_settings_import file.json --show-skipped

By default, only changes to the database are displayed. Use --show-skipped to display valid records that do not result in changes.

$ python manage.py content_settings_import file.json --import

Add --import to apply all approved records to the database.

$ python manage.py content_settings_import file.json --preview-for admin

Use --preview-for {username} to add all approved values to the user's preview group.

$ python manage.py content_settings_import file.json --import --names TITLE DESCRIPTION

Limit the imported values by specifying them with the --names argument.

You can also perform imports through the Django Admin Panel. Read more about it here.


Stand With Ukraine