【问题标题】:App Engine template values not showingApp Engine 模板值未显示
【发布时间】:2011-03-10 05:57:55
【问题描述】:

我正在尝试从静态文件中读取一行并将其插入到使用 Webapp 框架的 Google App 引擎中的模板中。但是,无论我尝试什么,这条线都不会渲染。有什么我忽略的吗?

main.py:

def get(self):
    ...
    question = randomLine("data/questions.csv")
    data = question.split(',')[0]

    template_values = {
        'data': data,
        }

    path = os.path.join(os.path.dirname(__file__), 'index.html')
    self.response.out.write(template.render(path, template_values))

index.html:

...
<div id="question">
    <p>{{ data }}</p>
</div>
...

【问题讨论】:

    标签: python google-app-engine templates


    【解决方案1】:

    没关系,我解决了。我重命名了main.py,但我没有在app.yaml 中更新它,所以即使我已经清除了我的缓存和数据存储,它仍然以某种方式加载剩下的内容。呵呵!

    【讨论】:

      猜你喜欢
      • 2013-07-30
      • 2018-04-12
      • 2012-09-14
      • 2012-03-23
      • 2019-04-14
      • 1970-01-01
      • 2015-05-26
      • 2019-11-13
      • 1970-01-01
      相关资源
      最近更新 更多