Trouble locating static audio file on Google App Engine

谁说胖子不能爱 提交于 2020-01-04 06:10:51

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/4174735/trouble-locating-static-audio-file-on-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!