Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This should do what you need:</p> <p><a href="https://gist.github.com/873098" rel="noreferrer">https://gist.github.com/873098</a></p> <p>Explanation: In App Engine Python it's possible to use regular expressions as URL handlers in <code>app.yaml</code> and redirect all URLs to a hierarchy of static files. </p> <p>Example <code>app.yaml</code>:</p> <pre><code>application: your-app-name-here version: 1 runtime: python api_version: 1 handlers: - url: /(.*\.css) mime_type: text/css static_files: static/\1 upload: static/(.*\.css) - url: /(.*\.html) mime_type: text/html static_files: static/\1 upload: static/(.*\.html) - url: /(.*\.js) mime_type: text/javascript static_files: static/\1 upload: static/(.*\.js) - url: /(.*\.txt) mime_type: text/plain static_files: static/\1 upload: static/(.*\.txt) - url: /(.*\.xml) mime_type: application/xml static_files: static/\1 upload: static/(.*\.xml) # image files - url: /(.*\.(bmp|gif|ico|jpeg|jpg|png)) static_files: static/\1 upload: static/(.*\.(bmp|gif|ico|jpeg|jpg|png)) # index files - url: /(.+)/ static_files: static/\1/index.html upload: static/(.+)/index.html # redirect to 'url + /index.html' url. - url: /(.+) static_files: static/redirector.html upload: static/redirector.html # site root - url: / static_files: static/index.html upload: static/index.html </code></pre> <p>In order to handle requests to URLs that don't end with a recognized type (<code>.html</code>, <code>.png</code>, etc.) or <code>/</code> you need to redirect those requests to <code>URL + /</code> so the <code>index.html</code> for that directory is served. I don't know of a way to do this inside the <code>app.yaml</code>, so I added a javascript redirector. This could also be done with a tiny python handler.</p> <p><code>redirector.html</code>:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;script language="JavaScript"&gt; self.location=self.location + "/"; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload