【问题标题】:Google App Engine: "We can not locate data file'Google App Engine:“我们找不到数据文件”
【发布时间】:2012-06-08 06:00:21
【问题描述】:

我是谷歌应用引擎的初学者。我的目标是将现有网页移植到 GAE。我遇到的困难集中在 .js 文件的位置。为了让它在我的本地机器上运行,我将 .js 文件放在一个静态目录中,并在 html 中引用了

<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 响应中?在你的日志中?通过信鸽?

标签: google-app-engine


【解决方案1】:

心理调试:区分大小写的文件名?,将文件名设为小写并将引用更改为小写。

【讨论】:

    猜你喜欢
    • 2019-10-31
    • 2023-03-25
    • 2019-07-10
    • 1970-01-01
    • 2013-09-23
    • 2010-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多