Diz
Diz

Reputation: 61

Running python script on static app engine site?

If I have a static website site on app engine (within a python runtime), if I want to make a jQuery AJAX call to a single python script to fetch something, do I have to put the whole site in a python framework just to run that file?

Using app engine standard.

Upvotes: 1

Views: 79

Answers (1)

Amber
Amber

Reputation: 526573

No. Just specify in your app.yaml a path that should be routed to a python app, and leave the rest of the paths mapped to your static site.

For example:

handlers:
- url: /your/ajax/call
  script: yourmodule.yourapp

- url: /(.*)
  static_files: static/\1
  upload: static/.*

Handlers are evaluated for matches in the order they're specified, so your ajax call will match its specific path, and the static handler will match anything else.

https://cloud.google.com/appengine/docs/standard/python/config/appref

Upvotes: 3

Related Questions