Installation | Maintenance | Beyond Lino

Lino and your Django settings

Remaining content is obsolete.


Lino applications (unlike Django projects) have a hook for specifying site-wide default values for their Django settings. This concept was used on servers where multiple Lino sites were running. Actually they are not system-wide but environment-wide.


Each time a Lino process starts (when a gets instantiated), it checks whether an environment variable LINO_SITE_MODULE is exists. And if it does, Lino expects it to be the name of a Python module, will import that module and, if it contains a function named setup_site, will call that function, passing it the Site instance as one and only positional parameter.

For example you can do:

$ export LINO_SITE_MODULE=my_site_options

And then create a file named somewhere on your PYTHONPATH with the following content:

def setup_site(self):
    self.update_settings(ADMINS=[("John", "")])
    self.use_java = False

By convention we recommend to name that file and to set LINO_SITE_MODULE to lino_local.

Keep in mind is a file containing site-wide local settings, i.e. local settings to be applied to all projects.

The file just defines default values, individual projects can still decide to override them.

This file is usually in a directory /usr/local/src/lino/.

Lino will use these settings only if that directory is in PYTHON_PATH and if the project defines an environment variable LINO_SITE_MODULE containing the string lino_local.

Historic note

The file was used until 20160109 as a hard-coded LINO_SITE_MODULE. Which had the disadvantage that it was not easy to disable it quickly.

On servers where this was used, when upgrading to a Lino version after 20160109, you should set LINO_SITE_MODULE to the string djangosite_local in order to maintain the old behaviour:

export LINO_SITE_MODULE=djangosite_local