Mix static and dynamic endpoints in the app.yaml file

I am trying to describe the endpoints in an App Engine application and am having difficulty with directory structures that mix static and dynamic content. But yaml rules contradict each other. Before changing the directory structure, does anyone have a recommendation?

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

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

What i think i should do with my yaml app ...

 - 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 assume the static_dir link static_dir breaking it. How can I do this without describing each script link and static file (I have many more than what is indicated here)?

+4
source share
1 answer

The reason for this is that you mark /api/ as a static directory, so your scripts are loaded as static files, which makes them inaccessible to the App Engine runtime.

The easiest solution is to place your dynamic code and your static resources in different parts of the hierarchy of your application directory and use app.yaml to map them to the desired URL structure.

+1
source

Source: https://habr.com/ru/post/1336619/


All Articles