def register_views(app_name, view_filename, urlpatterns=None):
app_module = __import__(app_name)<EOL>view_module = getattr(app_module, view_filename)<EOL>views = dir(view_module)<EOL>for view_name in views:<EOL><INDENT>if view_name.endswith('<STR_LIT>'):<EOL><INDENT>view = getattr(view_module, view_name)<EOL>if isinstance(view, object):<EOL><INDENT>if urlpatterns:<EOL><INDENT>urlpatterns  += patterns('<STR_LIT>',<EOL>url(r'<STR_LIT>' % view_name, view.as_view(),  name=view_name),<EOL>)<EOL><DEDENT>else:<EOL><INDENT>urlpatterns = patterns('<STR_LIT>',<EOL>url(r'<STR_LIT>' % view_name, view.as_view(),  name=view_name),<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>return urlpatterns<EOL>
app_name       APP名
view_filename  views 所在的文件
urlpatterns    url中已经存在的urlpatterns

return urlpatterns

只导入View结尾的，是类的视图