Chinaunix首页 | 论坛 | 博客
  • 博客访问: 547005
  • 博文数量: 142
  • 博客积分: 2966
  • 博客等级: 少校
  • 技术积分: 1477
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-07 22:37
文章分类

全部博文(142)

文章存档

2013年(3)

2012年(21)

2011年(53)

2010年(33)

2009年(32)

分类: Python/Ruby

2013-04-11 16:31:33

Extension Import Transition

For a while we recommended using namespace packages for Flask extensions. This turned out to be problematic in practice because many different competing namespace package systems exist and pip would automatically switch between different systems and this caused a lot of problems for users.

Instead we now recommend naming packages flask_foo instead of the now deprecatedflaskext.foo. Flask 0.8 introduces a redirect import system that lets uses import fromflask.ext.foo and it will try flask_foo first and if that fails flaskext.foo.

Flask extensions should urge users to import from flask.ext.foo instead of flask_foo orflaskext_foo so that extensions can transition to the new package name without affecting users.



例如:
import flask.ext.login
应该为
import flask_login
阅读(1999) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~