5

I'm trying to describe endpoints in my App Engine app and am having difficulty for directory structures that mix static and dynamic content. But my yaml rules are conflicting with one another. Before I change my directory structure, does anyone have a recommendation?

The goal is to create a directory that contains both documentation (static html files) and implementations.

/api
  - /v1
    - getitdone.py
  - doc.html
  - index.html

What I think I should be doing with my application yaml...

- url: /api/v1/getitdone
  script: api/v1/getitdone.py

- url: /api/
  static_files: api/index.html
  upload: api/index.html  

- url: /api
  static_dir: api

But this causes the dynamic endpoints to fail. I'm assuming the static_dir reference is breaking it. How can I do this without describing every script and static file reference (I have many more than are listed here)?

skolima
  • 31,963
  • 27
  • 115
  • 151
Greg
  • 2,559
  • 4
  • 28
  • 46
  • They 'fail' how? Endpoints are evaluated in order, so later declarations shouldn't affect earlier ones. – Nick Johnson Jan 23 '11 at 23:49
  • Also, are you sure this is how you want to handle it? 'Serving' .py files directly is rather unusual. – Nick Johnson Jan 23 '11 at 23:50
  • 'Fail' is defined by an IOError - IOError: [Errno 13] file not accessible: 'C:\\Greg\\personal\\projects\\\\api/v1/getarrivals.py)... The IOError only occurs when I use the statid_dir construct in that third entry. I think the solution is use wildcards for the html files and 'static_files'/'upload' constructs. – Greg Jan 24 '11 at 01:55
  • ... also that python endpoint is an exception. most python scripts handle multiple endpoints. is that what you're referring to? – Greg Jan 24 '11 at 01:56

1 Answers1

1

The cause of this is that you're marking /api/ as a static directory, so your scripts are getting uploaded as static files, which makes them inaccessible to the App Engine runtime.

The easiest solution would be to put your dynamic code and your static resources in different parts of your app's directory heirarchy, and use app.yaml to map them into the desired URL structure.

Nick Johnson
  • 100,655
  • 16
  • 128
  • 198
  • "...inaccessible to the App Engine runtime" is the detail I never realized. Thanks. – Greg Nov 20 '11 at 06:45