我包含google的angularjs脚本,但它们似乎不适用于该应用。如果我直接用互联网浏览器打开html网页,它可以正常工作。 该页面只是一个简单的测试,使用ng-model来查看您正在键入的内容并且它不会打印{{name}}
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
这是应用程序:
import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
class MainHandler(webapp.RequestHandler):
def get (self, q):
if q is None:
q = 'index.html'
path = os.path.join (os.path.dirname (__file__), q)
self.response.headers ['Content-Type'] = 'text/html'
self.response.out.write (template.render (path, {}))
def main ():
application = webapp.WSGIApplication ([('/(.*html)?', MainHandler)], debug=True)
util.run_wsgi_app (application)
if __name__ == '__main__':
main ()
这是我的app.yaml
application: sixth-tribute-676
version: 2
runtime: python27
api_version: 1
threadsafe: no
handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css))
static_files: \1
upload: (.*\.(gif|png|jpg|ico|js|css))
- url: .*
script: main.py
答案 0 :(得分:0)
问题在于我使用template.render
而{{name}}
消失了。我应该在不渲染的情况下提供html。