Opened 8 years ago

Closed 8 years ago

#15985 closed New feature (duplicate) syncdb without loading initial data

Reported by: michaeljean Owned by: nobody
Component: Core (Management commands) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I needed a way to rebuild the database structure without loading the initial data in order to make a custom subset of data. Basically what was needed was the same functionality as ' syncdb' except for the last step to load the initial data.

To do this, the django file django\core\management\ was examined and it was observed that omitting the loading of initial data required minimal changes to the existing file.
The file django\core\management\commands\ was copied and renamed django\core\management\commands\ Then the last 2 lines were deleted to disable the loading of the intial data:

from import call_command
call_command('loaddata', 'initial_data', verbosity=verbosity, database=db)

The new file enables the use of the command ' initializedb' using the same command line options as syncdb.

Example usage:
[root@oasdev os_so]# python initializedb --database='oas_datamart_test_data'

Handy for some things, violates DRY, but it works and I am am willing to contribute it.

Change History (1)

comment:1 Changed 8 years ago by Aymeric Augustin

Resolution: duplicate
Status: newclosed

Duplicate of #15926.

Note: See TracTickets for help on using tickets.
Back to Top