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響應中?在你的日誌中?通過信鴿? –