def startup(settings_module=None):
    "\n    Start up Django and Lino.\n\n    Optional `settings_module` is the name of a Django settings\n    module.  If this is specified, set the\n    :envvar:`DJANGO_SETTINGS_MODULE` environment variable.\n\n    This is called automatically when a process is invoked by an\n    *admin command*.\n\n    In a document to be tested using :cmd:`doctest` you need to call\n    it manually using e.g.:\n\n    >>> import lino\n    >>> lino.startup('my.project.settings')\n\n    Above two lines are recommended over the old-style method (the\n    only one only until Django 1.6)::\n\n    >>> import os\n    >>> os.environ['DJANGO_SETTINGS_MODULE'] = 'my.project.settings'\n    "
    if settings_module:
        os.environ['DJANGO_SETTINGS_MODULE'] = settings_module
    import django
    django.setup()
Start up Django and Lino.

Optional `settings_module` is the name of a Django settings
module.  If this is specified, set the
:envvar:`DJANGO_SETTINGS_MODULE` environment variable.

This is called automatically when a process is invoked by an
*admin command*.

In a document to be tested using :cmd:`doctest` you need to call
it manually using e.g.:

>>> import lino
>>> lino.startup('my.project.settings')

Above two lines are recommended over the old-style method (the
only one only until Django 1.6)::

>>> import os
>>> os.environ['DJANGO_SETTINGS_MODULE'] = 'my.project.settings'
def startup(settings_module=None):
    "\n    Start up Django and Lino.\n\n    Optional `settings_module` is the name of a Django settings\n    module.  If this is specified, set the\n    :envvar:`DJANGO_SETTINGS_MODULE` environment variable.\n\n    This is called automatically when a process is invoked by an\n    *admin command*.\n\n    In a document to be tested using :cmd:`doctest` you need to call\n    it manually using e.g.:\n\n    >>> import lino\n    >>> lino.startup('my.project.settings')\n\n    Above two lines are recommended over the old-style method (the\n    only one only until Django 1.6)::\n\n    >>> import os\n    >>> os.environ['DJANGO_SETTINGS_MODULE'] = 'my.project.settings'\n    "
    if settings_module:
        os.environ['DJANGO_SETTINGS_MODULE'] = settings_module
    import django
    django.setup()