Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

prep : load initial data into your database

pm prep

Flush the database and load the default demo fixtures.

Used to create your database and populate it with some demo content.

Calls initdb using the site’s lino.core.site.Site.demo_fixtures as arguments.

This command is defined by the lino core plugin. It is just a thin wrapper that calls pm initdb with a default list of fixtures to load.

Options:

--verbosity

The verbosity level (0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output). pm prep forwards this option to pm initdb.

--keepmedia

Do NOT remove media files.

pm prep adds the pm initdb --removemedia option when calling pm initdb. In a developer environment you usually want pm prep to remove any media files. But for example on a demo server you can call --keepmedia if you DON’T want pm prep to remove them.

Side note: Code snippets (lines starting with >>>) in this document get tested as part of our development workflow. The following initialization snippet tells you which demo project is being used in this document.

>>> import lino
>>> lino.startup('lino_book.projects.min1.settings')
>>> from lino.api.doctest import *
>>> from atelier.sheller import Sheller
>>> shell = Sheller(settings.SITE.project_dir)
>>> shell("django-admin prep --help")  
usage: django-admin prep [-h] [--noinput] [--keepmedia] [--version]
                         [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback]
                         [--no-color] [--force-color] [--skip-checks]

Flush the database and load the default demo fixtures.

options:
  -h, --help            show this help message and exit
  --noinput             Do not prompt for input of any kind.
  --keepmedia           Do not remove media files.
  --version             Show program's version number and exit.
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions.
  --no-color            Don't colorize the command output.
  --force-color         Force colorization of the command output.
  --skip-checks         Skip system checks.