跳转到主要内容

移动设备检测库和wsgi中间件

项目描述

请参阅http://mobi.infrae.com/上的文档。

mobi.devices是一组检测移动用户代理的工具。它使用WURFL数据库以及来自MIT移动项目的数据。

它提供WSGI中间件,可以将关于执行请求的设备的详细信息标记到请求上。

为了获得最佳性能,请安装pytc。由于它不是所有平台上都可用,因此它不是包要求。

Paster示例配置

[app:yourapp]
# This part describes your application
# use = ...

[filter:mobidevicedetection]
# The entry point to use the classifier
use = egg:mobi.devices#classifier
# cache the classification on a client side cookie (default: true)
cookie_cache = true
# Configure caching (see beaker documentation)
cache.type = ext:memcached
cache.url = 127.0.0.1:11211
cache.lock_dir = /tmp/mobicache
# Data directory *required*. make sure directory is writable
# by the user that run the webserver
var = /var/mobi/db
# Path to wurfl file. by default it uses the one shipped with
# this package. however you should use the latest one.
wurfl_file = /var/mobi/wurfl.xml.gz

[filter:mobirouter]
use = egg:mobi.devices#router
# Redirect mobile devices that connect to infrae.com hostname
# to m.infrae.com
infrae.com = http://m.infrae.com/

[pipeline:main]
# This part configures the actual WSGI stack
pipeline = mobidevicedetection mobirouter yourapp

[server:main]
# This is the configuration for the paster web server.
# It must have the same name as the pipeline.
use = egg:Paste#http
host = 0.0.0.0
port = 8080
threadpool_workers = 7

如果您使用Apache并且具有修改路径的重写规则,并且想要路由器在原始路径上路由,请在任何重写规则之前添加以下规则

RewriteRule ^(.*)$ - [E=ORIGINAL_PATH:$1]
RequestHeader set X_ORIGINAL_PATH %{ORIGINAL_PATH}e

变更日志

mobi.devices 1.2 (2011-04-14)

  • 添加更多配置选项(Bruno Binet)

mobi.devices 1.1 (2010-12-20)

  • 添加原始路径HTTP头部处理器,以便路由器与重写规则一起工作。

  • 添加简单的路由中间件。

mobi.devices 1.0.1 (2010-09-14)

  • 修复WURFL文件配置处理

  • 修复缺失的导入

mobi.devices 1.0 (2010-09-13)

  • 为WURFL添加新引擎

mobi.devices 1.0b1 (2010-07-14)

  • 第一个版本,请参阅README.txt

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

mobi.devices-1.2.tar.gz (938.4 kB 查看哈希值)

上传于 源代码

由以下支持