How to write static_files exclude one subdirectory in yaml of Google App Engine
With app.yml in GAE, we use regular expressions to match a certain type of url address.
If I want to match a subdirectory of the path which is not a particula string(exclude one ), I do not know how to write regular expression?
For example:
I want to upload foo/bar/.* as static files exclude any files in foo/bar/dir/.* , how to deal with this in app.yaml .
include files in dir as static files like :
foo/bar/main.css
foo/bar/js/main.js
exclude files in dir(to use these files as application templates) like this:
foo/bar/views/index.html
The reason why I need this function is that I have mixed templates file with static files in a parent file. like Wordpres开发者_JS百科s theme templates file.
Thanks.
Most people keep all their static files in a subdirectory called "public" or "static" to avoid this issue, and I recommend you do the same.
You could add a line to catch your files by extension like:
- url: /foo/bar/([^.]+\.(js|css))
static_files: foo/bar/\1
upload: foo/bar/[^.]+\.(js|css)
精彩评论