【发布时间】:2014-01-22 15:03:26
【问题描述】:
我有这个主 html 模板:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Start Bootstrap - SB Admin Version 2.0 Demo</title>
<!-- Core CSS - Include with every page -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">
<!-- SB Admin CSS - Include with every page -->
<link href="css/sb-admin.css" rel="stylesheet">
<!-- Core Scripts - Include with every page -->
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<!-- SB Admin Scripts - Include with every page -->
<script src="js/sb-admin.js"></script>
</head>
这是 test.py 文件:
from wheezy.template.engine import Engine
from wheezy.template.ext.core import CoreExtension
from wheezy.template.loader import FileLoader
T = ['where/project/folderbase/is']
engine = Engine(
loader=FileLoader(T),
extensions=[CoreExtension()]
)
master_template = engine.get_template(r'master.htm')
@route('/test')
def login_name():
return master_template.render({})
我在模板和网页设计方面完全是 n00b。 假设我通过 localhost:port/test
上的任何 python Web 服务器(如烧瓶)运行它什么都没有。
为什么?
wheezy.template 中的 @path_for 是什么?
我需要包含@require(path_for) 或其他任何内容吗?
是否需要在 html 文件中提供静态文件以定义特定文件夹中的所有文件-> 'static'
或者可以从它们现在所在的位置访问它们,就像上面的代码一样?
【问题讨论】:
标签: python css template-engine