简化 appengine 的 yaml 路由规则 (python)
Simplify yaml routing rules for appengine (python)
我的图像文件夹中有 17 个文件。我已经为他们创建了 17 条规则,我想对其进行简化,即制定一条适用于正则表达式或其他规则的规则。有办法吗?
- url: /favicon.ico
static_files: images/favicon.ico
upload: images/favicon.ico
- url: /apple-touch-icon-57x57.png
static_files: images/apple-touch-icon-57x57.png
upload: images/apple-touch-icon-57x57.png
- url: /apple-touch-icon-60x60.png
static_files: images/apple-touch-icon-60x60.png
upload: images/apple-touch-icon-60x60.png
- url: /apple-touch-icon-72x72.png
static_files: images/apple-touch-icon-72x72.png
upload: images/apple-touch-icon-72x72.png
...
我最终使用了这些规则:
- url: /(apple-touch-icon.*\.(png))
static_files: images/
upload: images/(apple-touch-icon.*\.(png))
- url: /(android-chrome.*\.(png))
static_files: images/
upload: images/(android-chrome.*\.(png))
- url: /(mstile.*\.(png))
static_files: images/
upload: images/(mstile.*\.(png))
- url: /(favicon-.*\.(png))
static_files: images/
upload: images/(favicon-.*\.(png))
- url: /favicon.ico
static_files: images/favicon.ico
upload: images/favicon.ico
看看 Google App Engine Boilerplate:
- url: /(\w*)/(apple-touch-icon.*\.(png))
static_files: bp_content/themes//static/
upload: bp_content/themes/(\w*)/static/(apple-touch-icon.*\.(png))
这是满足您需求的相关资源,您可能还会学到一些技巧:)
我的图像文件夹中有 17 个文件。我已经为他们创建了 17 条规则,我想对其进行简化,即制定一条适用于正则表达式或其他规则的规则。有办法吗?
- url: /favicon.ico
static_files: images/favicon.ico
upload: images/favicon.ico
- url: /apple-touch-icon-57x57.png
static_files: images/apple-touch-icon-57x57.png
upload: images/apple-touch-icon-57x57.png
- url: /apple-touch-icon-60x60.png
static_files: images/apple-touch-icon-60x60.png
upload: images/apple-touch-icon-60x60.png
- url: /apple-touch-icon-72x72.png
static_files: images/apple-touch-icon-72x72.png
upload: images/apple-touch-icon-72x72.png
...
我最终使用了这些规则:
- url: /(apple-touch-icon.*\.(png))
static_files: images/
upload: images/(apple-touch-icon.*\.(png))
- url: /(android-chrome.*\.(png))
static_files: images/
upload: images/(android-chrome.*\.(png))
- url: /(mstile.*\.(png))
static_files: images/
upload: images/(mstile.*\.(png))
- url: /(favicon-.*\.(png))
static_files: images/
upload: images/(favicon-.*\.(png))
- url: /favicon.ico
static_files: images/favicon.ico
upload: images/favicon.ico
看看 Google App Engine Boilerplate:
- url: /(\w*)/(apple-touch-icon.*\.(png))
static_files: bp_content/themes//static/
upload: bp_content/themes/(\w*)/static/(apple-touch-icon.*\.(png))
这是满足您需求的相关资源,您可能还会学到一些技巧:)