我如何在mako中执行此操作:
<% import cherrypy %>
...
<link rel="stylesheet" href="${cherrypy.url('/media/layout.css')}" type="text/css" />
AttributeError: 'Undefined' object has no attribute 'url'
答案 0 :(得分:3)
答案:而不是<% import cherrypy %>
需要<%! import cherrypy %>