我正在将web.py用于python3。并得到一个错误。
错误:
功能渲染。 getattr .. template at 0x7fcf15a43840
main.py
function getRegRelasilNews($id, $slug, $limit) {
$ur = base_url();
$parse = parse_url($ur);
$host = explode('.', $parse['host']);
$subdomain = $host[0];
$this->db->select('*');
$this->db->join('post_reg_sub_cat', 'post_reg_sub_cat.id=posts.regional','left');
$this->db->join('post_reg_cat', 'post_reg_cat.id_reg_cat=post_reg_sub_cat.id_reg_cat','left');
$this->db->where('id_post !=', $id);
$this->db->where('post_reg_cat.reg_cat', $subdomain);
$this->db->where('MATCH (title) AGAINST("'.$slug.'")' , NULl);
$this->db->limit($limit);
return $this->db->get($this->table)->result();
}
Views / Templates / MainLayout.html
import web
from web.template import render
urls = (
'/', 'Home'
)
render = web.template.render('Views/Templates/', base='MainLayout')
app = web.application(urls, globals())
#routes
class Home:
def GET(self):
return render.Home
if __name__ == '__main__':
app.run()
Views / Templates / Home.html
def with (page)
<html>
<head>
<title> Title </title>
</head>
<body>
<div id='app'>
$:page
</div>
</body>
</html>