Commands#
Here is a detail of all available Django commands supplied by Diskette. Although their detail does not include it, they all inherit from Django command default options.
diskette_dump#
Dump configured application data and media files into an archive.
Initially the command should get its configuration from Settings but you are able to override them with available command options.
- Usage
python manage.py diskette_dump [options]
- Options
Option
Type
Help
--destination
Path
Directory path where to write the dump archive. If given path does not exists it will be created. Default to current working directory.
--filename
str
Custom archive filename to use for this dump. This is only the filename, don’t include directory path here. Your filename must ends with ‘tar.gz’.
--appconf
Path
Path to a JSON file with application configurations for data dump. This will overwrite application configurations settings.
--storage
Path
This is a cumulative argument. Using this argument will overwrite storages settings.
--storages-basepath
Path
Custom basepath to resolve storage files paths.
--storages-exclude
str
This is a cumulative argument. Using this argument will overwrite storage excludes settings.
--indent
int
Specifies the indent level to use when pretty-printing output.
--no-data
bool
Disable application data dumps.
--no-checksum
bool
Disable archive checksum. Default behavior is to always compute a checksum of created archive and output it.
--no-storages
bool
Disable storages dump.
--no-storages-excludes
bool
Disable usage of storage excluding patterns.
--no-archive
bool
Output command lines to perform data dumps instead of making an archive. This does not care about storages, checksum, etc.. Note thanthose command lines will start directly with the command name. You will need to prefix them your proper path to ‘django-admin’ or ‘manage.py’.
--check
bool
Don’t make archive or write anything on filesystem. Only validate configuration and output informations about dump. You should use this with option ‘-v 3’ to get the whole informations.
diskette_load#
Restore application datas and storage files from an archive file previously created
with diskette_dump
.
- Usage
python manage.py diskette_load <archive> [options]
- Options
Option
Type
Help
archive
str
Archive file path to restore its content.
--storages-basepath
Path
Directory path where to restore storage contents.
--exclude-data
str
This is a cumulative argument. Given dump filenames will be ignored from loading.
--no-data
bool
Disable application data restoration.
--no-storages
bool
Disable storages restoration.
--download-destination
Path
Directory path where to write download archive. This option is ignored for local archive file.
--keep
bool
Don’t automatically remove archive when finished.
--checksum
str
Checksum string to compare to the archive checksum, if checksum comparison fails operation is aborted. Give value ‘no’ to disable checksum creation from archive.
diskette_apps#
This command helps to see all possible application definitions from currently installed applications in your project.
This is especially useful when you start to create application definitions to quickly get a base to start from or to update definitions after enabling new applications.
Usage:
python manage.py diskette_apps [options]
- Options
Option
Type
Help
--destination
Path
File path where to write built definitions. If not given the definition list is printed to the standard output.
--app
str
This is a cumulative argument. If not empty, the definition list will be filtered with the given app lists. All other apps from ‘settings.INSTALLED_APPS’ will be ignored. Given app names are not validated, if invalid will just be ignored.
--exclude
str
This is a cumulative argument. Given app names will be ignored from list definition. This have priority over app name inclusions from the ‘–app’ option.
--format
str
Specifies the output serialization format for definition list. It is either ‘json’ or ‘python’. Default is ‘python’
polymorphic_dumpdata#
A command alike Django’s dumpdata but it enforces usage of
legacy django.db.models.query.QuerySet
over custom model queryset.
This is needed to dump data for polymorphic models that won’t work properly,
especially when used from django.core.management.call_command
.
Original code comes from a czpython Gist found from django-filer issue 887. This should resolves problem demonstrated in django-polymorphic issue 175.
However this only supports a few set of legacy dumpdata options. Unavailable options are still present but will raise a NotImplementedError when used, in the following table they are marked as NOT IMPLEMENTED.
Usage:
python manage.py polymorphic_dumpdata <args> [options]
- Options
Option
Type
Help
args
str
Restricts dumped data to the specified app_label or app_label.ModelName.
--format
str
Specifies the output serialization format for fixtures. Only ‘json’ format is implemented.
--indent
int
Specifies the indent level to use when pretty-printing output.
--database
str
Nominates a specific database to dump fixtures from. Defaults to the “default” database. NOT IMPLEMENTED.
-e
/--exclude
str
An app_label or app_label.ModelName to exclude (use multiple –exclude to exclude multiple apps/models).
--natural-foreign
bool
Use natural foreign keys if they are available.
--natural-primary
bool
Use natural primary keys if they are available.
-a
/--all
bool
Use Django’s base manager to dump all models stored in the database, including those that would otherwise be filtered or modified by a custom manager. NOT IMPLEMENTED.
--pks
str
Only dump objects with given primary keys. Accepts a comma-separated list of keys. This option only works when you specify one model. NOT IMPLEMENTED.
-o
/--output
Path
Specifies file to which the output is written.