将静态目录内容部署到谷歌应用程序引擎 [英] Deployment of static directory contents to google app engine

查看:98
本文介绍了将静态目录内容部署到谷歌应用程序引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经部署了我的第一个GAE应用程序,并且在我的主页上收到了TemplateDoesNotExist异常。感觉就像我的静态目录内容没有上传到GAE。
是不是我可以更新(appcfg.py更新myapp /)我的所有文件,包括静态文件,并在myappid.appspot.com上单独运行?



顺便说一句,在这里你可以看到问题:
http://pollbook.appspot.com

a>



PS:我的应用程序在本地完美工作

解决方案

不应将模板存储在app.yaml中称为静态的目录中。静态目录用于字面上的静态文件,它们将由CDN提供给最终用户而不更改。这些文件不能被模板引擎读取。它在本地工作,因为dev_appserver没有精确模拟生产服务器。



将模板放在/ templates或其他目录中。你不需要在你的app.yaml中引用这个目录。


I've deployed my first GAE application and I am getting "TemplateDoesNotExist" exception at my main page. It feels like my static directory content is not uploaded to GAE. Isn't it possible that I update (appcfg.py update myapp/) all my files including the static ones and run it standalone on myappid.appspot.com ?

by the way here you can see the problem: http://pollbook.appspot.com

PS: my app works perfect locally

解决方案

Your templates should not be stored in a directory that you refer to as "static" in app.yaml. Static directories are for literally static files that will be served to end users by the CDN without changing. These files cannot be read by the templating engine. It works locally because the dev_appserver does not precisely emulate the production server.

Put your templates in a different directory like /templates or something. You do not need to refer to this directory in your app.yaml.

这篇关于将静态目录内容部署到谷歌应用程序引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆