0
我是一个初学者,使用谷歌应用程序引擎。我的目标是将现有网页移植到GAE。我的难点在于围绕.js文件的位置。为了得到它,以我的本地机器上运行,我把.js文件在静态目录中引用的HTML像Google App Engine:“我们无法找到数据文件”
<link href="/static/tblDz_Qs_clinical.js"....
一切正常,我的本地机器上,但是当我部署,我得到一个消息,
'we cannot locate the datafile
http://dermdudes.appspot.com/static/tblDz_Qs_clinical.js'
这里是main.py:
import os
import webapp2
import jinja2
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir), autoescape=False)
class Handler(webapp2.RequestHandler):
def write(self, *a, **kw):
self.response.out.write(*a, **kw)
def render_str(self, template, **params):
t = jinja_env.get_template(template)
return t.render(params)
def render(self, template, **kw):
self.write(self.render_str(template, **kw))
class MainHandler(Handler):
def get(self):
self.render('DD_querydriven2.html')
app = webapp2.WSGIApplication([('/', MainHandler)],
debug=True)
这里是app.yaml中:
application: dermdudes
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /static
static_dir: static
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.1"
- name: jinja2
version: latest
这里是在被触发消息的HTML参考:
<link href="/static/tblDz_Qs_clinical.js" type="application/json" rel="exhibit/data" />
如果我只能拿GAE找到。 js文件,那么一切都将是完美的。谢谢你的帮助。
你得到一个消息在哪里?在你的HTTP响应中?在你的日志中?通过信鸽? –