melder
melder

Reputation: 21

Trouble locating static audio file on Google App Engine

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.

Upvotes: 2

Views: 273

Answers (1)

Klaus Byskov Pedersen
Klaus Byskov Pedersen

Reputation: 121067

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

Upvotes: 2

Related Questions