无法在Google App Engine上查找静态音频文件 [英] Trouble locating static audio file on Google App Engine

查看:106
本文介绍了无法在Google App Engine上查找静态音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目目录和一个子目录:

/ proj_dir

/ proj_dir / audio
$ b $ app.yaml:

 处理程序:
- url:/.*
script:main.py

- url:/ audio
static_dir:audio

main.py是一个简单的Python程序,它在GET请求中输出proj_dir目录中的index.html文件。 index.html文件包含播放音频文件的一些javascript代码。



问题在于,index.html在本地运行时没有问题地播放音频文件。一旦部署,然而,我试图检索音频时得到一个404:

  INFO 2010-11-13 20:43: 10,046 dev_appserver.py:3283]GET /audio/bangagong.mp3 HTTP / 1.1404  -  

任何帮助赞赏。感谢。

解决方案

您需要更改您的url处理程序的顺序。 *处理程序捕获所有内容。试试这个:

 处理程序:
- url:/ audio
static_dir:audio

- url:/.*
script:main.py


I have a project directory and a sub directory set up as such:

/proj_dir

/proj_dir/audio

app.yaml:

handlers:
- url: /.*
  script: main.py

- url: /audio
  static_dir: audio

main.py is a simple Python program that, on a GET request, outputs the "index.html" file also in the proj_dir directory. The index.html file contains some javascript code that plays the audio file.

The problem is that index.html plays the audio file without issue when run locally. Once deployed, however, I get a 404 when trying to retrieve the audio:

INFO     2010-11-13 20:43:10,046 dev_appserver.py:3283] "GET /audio/bangagong.mp3 HTTP/1.1" 404 -

Any help appreciated. Thanks.

解决方案

You need to change the order of your url handlers. The * handler captures everything. Try this instead:

handlers:
- url: /audio
  static_dir: audio

- url: /.*
  script: main.py

这篇关于无法在Google App Engine上查找静态音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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