微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Bottle.py MVC“找不到模板”

我想要做什么:

下面是我试图从 mongodb blog blog.py运行的代码

@bottle.route('/') def blog_index(): cookie = bottle.request.get_cookie("session") username = sessions.get_username(cookie) return bottle.template('blog_template',username=username))

从terminal运行blog.py并浏览到localhost:8082后,我得到以下错误

找不到模板“blog_template”。

用UAC进行Windows UAC安全

写特权 – 本地主机 – Mac OSX

在Ubuntu 14.04上为所有用户设置全局的ruby

AdjustTokenPrivileges错误6 – 处理无效

以非root用户身份以编程方式删除Linuxcaching

上周我有一个类似的问题,我通过将文件夹权限更改为777(只是为了排除权限问题)而解决了这个问题,但是目前在所有子文件夹中都设置为 mongodb,而我仍然遇到相同的问题。

这些模板都位于bottle.py文档中指定的 mongodb blog views中

目前对该文件夹的权限如下:( 调节器是我login的用户

-rwxrwxrwx 1 regulator regulator 718 Mar 23 2015 blog_template.tpl -rwxrwxrwx 1 regulator regulator 1211 Mar 23 2015 entry_template.tpl -rwxrwxrwx 1 regulator regulator 113 Mar 23 2015 error_template.tpl -rwxrwxrwx 1 regulator regulator 816 Mar 23 2015 login.tpl -rwxrwxrwx 1 regulator regulator 581 Mar 23 2015 newpost_template.tpl -rwxrwxrwx 1 regulator regulator 1454 Mar 23 2015 signup.tpl -rwxrwxrwx 1 regulator regulator 368 Mar 23 2015 welcome.tpl

我很积极,这是一个基于权限的问题,我忽略了一些非常基本的东西,但由于我已经排除了最近3个小时的这个问题,我将不胜感激。

什么权限需要在bottly.py工作? 这是logging在任何地方(ive看透了http://bottlepy.org/docs/可以找不到这个信息)?

– – – – – – – – – – 编辑 – – – – – – – – – –

自写这个我也尝试了以下

我重新创build了一个新的testing项目来testing只有模板部分文件夹结构是

testing| _test.py | _views | __test.tpl

我试图运行这个作为SUDO和没有sudo。

所有文件夹权限是777

test.py中的代码如下

from bottle import route,run,template @route('/hello') def hello(): ##return "<h1>Hello World!</h1>" output = template('test') return output run(host='0.0.0.0',port=8080)

权限

regulator@HP-EB8460p-UbGnome:/mongodb$ ls -l /mongodb/test/* -rwxrwxrwx 1 root root 191 Jan 25 19:10 /mongodb/test/test.py /mongodb/test/views: total 4 -rwxrwxrwx 1 root root 141 Jan 25 19:12 test.tpl

最后是.tpl文件

<!DOCTYPE html> <html> <head> <title>Why wont I work!!</title> </head> <body> <h1>THIS IS A TEST</h1> IF YOU CAN SEE THIS THE TEST WORKS!!! </body> </html>

Mac OSX的Apache写权限

检查两个NTAccount对象的相等性

需要Windows chmod777等效

Linux的权限(LAMP)

PHP Linux + Windows – 共享和权限

也许你没有改变TEMPLATE_PATH?

bottle.TEMPLATE_PATH += './mongodb/blog/views' #change this to the place your templates are found in

我希望这有帮助

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐