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
my_site_options.py somewhere on
PYTHONPATH with the following content:
def setup_site(self): self.update_settings(ADMINS=[("John", "email@example.com")]) self.update_settings(EMAIL_HOST="mail.provider.com") self.update_settings(DEBUG=True) self.update_settings(ALLOWED_HOSTS=['127.0.0.1']) self.use_java = False
Keep in mind
lino_local.py 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
Lino will use these settings only if that directory is in
PYTHON_PATH and if the project defines an environment
LINO_SITE_MODULE containing the string
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: