diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-02-19 09:04:19 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-02-19 09:04:19 +0000 |
| commit | 25b5da2abdebef867f1e38c95f5622df3741d0db (patch) | |
| tree | 09e200af5a31a0f1bcd08590d71676b920a7f1e1 /docs/howto/initial-data.txt | |
| parent | 7baee7a03b8f9ec4840942eecb80fcbe1c75b231 (diff) | |
[1.3.X] Fixed #17166 -- Documented how FIXTURE_DIRS works in the inital data how-to, and edited related bits in the settings reference. Backport of r17558 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@17559 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/howto/initial-data.txt')
| -rw-r--r-- | docs/howto/initial-data.txt | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/docs/howto/initial-data.txt b/docs/howto/initial-data.txt index dd6a099b9d..69e728ef16 100644 --- a/docs/howto/initial-data.txt +++ b/docs/howto/initial-data.txt @@ -13,6 +13,8 @@ but initial SQL is also quite a bit more flexible. .. _initial data as sql: `providing initial sql data`_ .. _initial data via fixtures: `providing initial data with fixtures`_ +.. _initial-data-via-fixtures: + Providing initial data with fixtures ==================================== @@ -65,12 +67,12 @@ And here's that same fixture as YAML: You'll store this data in a ``fixtures`` directory inside your app. -Loading data is easy: just call :djadmin:`manage.py loaddata fixturename -<loaddata>`, where *fixturename* is the name of the fixture file you've created. -Every time you run :djadmin:`loaddata` the data will be read from the fixture -and re-loaded into the database. Note that this means that if you change one of -the rows created by a fixture and then run :djadmin:`loaddata` again you'll -wipe out any changes you've made. +Loading data is easy: just call :djadmin:`manage.py loaddata <fixturename> +<loaddata>`, where ``<fixturename>`` is the name of the fixture file you've +created. Every time you run :djadmin:`loaddata` the data will be read from the +fixture and re-loaded into the database. Note that this means that if you +change one of the rows created by a fixture and then run :djadmin:`loaddata` +again you'll wipe out any changes you've made. Automatically loading initial data fixtures ------------------------------------------- @@ -80,6 +82,17 @@ be loaded every time you run :djadmin:`syncdb`. This is extremely convenient, but be careful: remember that the data will be refreshed *every time* you run :djadmin:`syncdb`. So don't use ``initial_data`` for data you'll want to edit. +Where Django finds fixture files +-------------------------------- + +By default, Django looks in the ``fixtures`` directory inside each app for +fixtures. You can set the :setting:`FIXTURE_DIRS` setting to a list of +additional directories where Django should look. + +When running :djadmin:`manage.py loaddata <loaddata>`, you can also +specify an absolute path to a fixture file, which overrides searching +the usual directories. + .. seealso:: Fixtures are also used by the :ref:`testing framework |
