原文:http://www.wangting.name/?p=399

摘录如下:
odoo dbfilter 使用方法

以下说明摘自官方文档:

--db-filter

hides databases that do not match . The filter is a regular expression, with the additions that:

%h is replaced by the whole hostname the request is made on.
%d is replaced by the subdomain the request is made on, with the exception of www (so domain odoo.com and www.odoo.com both match the database odoo)
实际应用操作步骤:

在odoo配置文件里,加入 dbfilter = ^%d 。
建立两个数据库,名字分别为:demo 、cnietech。
域名cnietech.com和www.cnietech.com,二级域名demo.cnietech.com,都设置解析到服务器。

实现效果:

cnietech.com和www.cnietech.com:自动访问cnietech数据库,并且不出现数据库选择画面。这很重要,多数据库在某些场合,会导致website的网页访问失败。
demo.cnietech.com:如果当前有多个demo开头的数据库,就出现数据库选择画面;如果当前只有一个demo开头的数据库,则直接访问唯一的那个demo数据库;如果没有demo开头的数据库,提示创建数据库。