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
--destinationPath
Directory path where to write the dump archive. If given path does not exists it will be created. Default to current working directory.
--filenamestr
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’.
--appconfPath
Path to a JSON file with application configurations for data dump. This will overwrite application configurations settings.
--storagePath
This is a cumulative argument. Using this argument will overwrite storages settings.
--storages-basepathPath
Custom basepath to resolve storage files paths.
--storages-excludestr
This is a cumulative argument. Using this argument will overwrite storage excludes settings.
--indentint
Specifies the indent level to use when pretty-printing output.
--no-databool
Disable application data dumps.
--no-checksumbool
Disable archive checksum. Default behavior is to always compute a checksum of created archive and output it.
--no-storagesbool
Disable storages dump.
--no-storages-excludesbool
Disable usage of storage excluding patterns.
--no-archivebool
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’.
--checkbool
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.
--savebool
Save a Dump object from created dump. This is incompatible with options ‘–check’, ‘–no-archive’ and with disabled admin.
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
archivestr
Archive file path or URL to restore its content.
--storages-basepathPath
Directory path where to restore storage contents.
--exclude-datastr
This is a cumulative argument. Given dump filenames will be ignored from loading.
--no-databool
Disable application data restoration.
--no-storagesbool
Disable storages restoration.
--download-destinationPath
Directory path where to write download archive. This option is ignored for local archive file.
--ignorenonexistent_databool
If true, fields and models that does not exists in current models will be ignored instead of raising an error. This is false on default.
--keepbool
Don’t automatically remove archive when finished.
--checksumstr
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
--destinationPath
File path where to write built definitions. If not given the definition list is printed to the standard output.
--appstr
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.
--excludestr
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.
--formatstr
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
argsstr
Restricts dumped data to the specified app_label or app_label.ModelName.
--formatstr
Specifies the output serialization format for fixtures. Only ‘json’ format is implemented.
--indentint
Specifies the indent level to use when pretty-printing output.
--databasestr
Nominates a specific database to dump fixtures from. Defaults to the “default” database. NOT IMPLEMENTED.
-e/--excludestr
An app_label or app_label.ModelName to exclude (use multiple –exclude to exclude multiple apps/models).
--natural-foreignbool
Use natural foreign keys if they are available.
--natural-primarybool
Use natural primary keys if they are available.
-a/--allbool
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.
--pksstr
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/--outputPath
Specifies file to which the output is written.