如何修复python3 web.py中的``<function render .__ getattr __。<locals =“”>。template at 0x7f1dafac8400>```错误

时间:2019-04-12 07:28:49

标签: python-3.x web.py

我正在将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>

0 个答案:

没有答案