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

Serve multiple domains with a single Lino site

A single Lino site can serve multiple “domains”. This feature is under development. Not finished.

This page contains code snippets (lines starting with >>>), which are being tested during our development workflow. The following snippet initializes the demo project used throughout this page.

>>> from lino_book.projects.noi2.startup import *
>>> from django.db.models import Q

Example for developers

As a developer you can play with this feature using the noi2 : Noi with publisher and without accounting demo project as showcase. This project has the following system.host2config setting in its settings.py file:

>>> pprint(dd.plugins.system.host2config)
{'127.0.0.1:8000': None,
 'circus.noi2:8000': 2,
 'laundry.noi2:8000': 3,
 'locahost:8000': None}

To fully play with the noi2 site, you must edit your /etc/hosts file to define “circus.noi2” and “laundry.noi2” as alias names for 127.0.0.1:

127.0.0.1       circus.noi2
127.0.0.1       laundry.noi2

You then run pm runserver in noi2 and point your browser to different URLs, which will all be served by the same Lino process:

Usage in production

As a hosting provider you make a Lino site multidomain by configuring the system.host2config setting in your settings.py file, and by configuring your web server to serve all domains from the same Lino site.