Lino and local files¶
Lino sets these two attributes automatically when the
You should not override them.
Site.project_dir is the directory containing your
file. Or more precisely the directory containing the source file of your
DJANGO_SETTINGS_MODULE. When using a settings package,
Site.project_dir points to the
settings subdir of what
getlino calls the project directory.
When an environment variable
LINO_CACHE_ROOTis defined, Lino sets the
Site.project_name. This is used in CI environments where we use settings from a code repository (e.g. book) and don't want to write to the repository itself.
site_dir is the root for some subdirectories with special meaning:
migrationsdirectory will activate Django migrations.
configdirectory will be added to the config search path. See local config files.
static_rootdirectory is the default value for
site_dir is also where the
default.db file sits when
- site cache¶
The directory where Lino automatically generates certain files to be served as media files.
The front end populates the site cache either "late" or "early", where "late"
means on each incoming request, and "early" means during explicit
On a production site we want to call it "early": we explicitly run
buildcache after an
upgrade, and don't want Lino to waste resources by checking whether it's done
again and again for every incoming request. But when developing, we don't want
Lino to generate all js files (for all user types and all languages) for every
little change in the source code.
lino.core.site.Site.build_js_cache_on_startup attribute is False.
On a production site,
Site.build_js_cache_on_startup should be
True for best performance, but during development and testing this is not
necessary, so default value is False, which means that each file is built upon
need (when a first request comes in).
You can also set
Site.build_js_cache_on_startup to None, which means
that Lino decides automatically during startup: it becomes False if either
lino.core.utils.is_devserver() returns True or
DEBUG is set.
If a variable of that name is set, then Lino will override the code value and set
When some exception occurs while populating the site cache Lino usually removes
the partly generated file to make sure that it will try to generate it again
(and report the same error message) for every subsequent next request. You can
Site.keep_erroneous_cache_files to True if you need to see the
partly generated cache file. Don't forget to remove this when you have
inspected the file and fixed the reason of the exception, because if this is
True and some next exception occurs (which will happen sooner or later), then
all subsequent requests will usually end up to the user with a blank screen and
(if they notice it), a message
TypeError: Lino.main_menu is undefined