我正在尝试为一个Google应用程序创建一个静态html组件(可以脱机使用),而这个应用程序不是Python。你知道吗
我似乎无法为此正确配置app.yaml
文件。你知道吗
handlers:
# Serve images and JSON as static resources.
- url: /(.+\.(gif|png|jpg|json|ico))$
static_files: \1
upload: .+\.(gif|png|jpg|json|ico)$
application_readable: true
- url: \/(static)\/(index)\.html
static_files: static/\1/index.html
upload: static\/index.html
- url: /
script: roomusage.app
login: required
secure: always
- url: /welcome
script: roomusage.app
login: required
secure: always
- url: /record
script: record_usage.app
login: required
secure: always
下面是我收到的错误信息:
appcfg.py: error: Error parsing C:\gcloud\dev-myapp\app.yaml: Unable to assign value '\/(static)\/(index)\.html' to attribute 'url':
Value '\/(static)\/(index)\.html' for url does not match expression '^(?:(?!\^)/.*|\..*|(\(.).*(?!\$).)$'
in "C:\gcloud\dev-myapp\app.yaml", line 25, column 8.
2017-12-08 09:27:50 (Process exited with code 2)
您的
\/(static)\/(index)\.html
模式是无效的URL regex模式。你知道吗首先-模式不能以
\
开头-您不需要转义/
。你知道吗模式中的圆括号用于标识位置分组,这些位置分组可以在随后的语句中被
\1
、\2
等称为参数,例如static_files
。从Handlers elements表的url
行:如果您不需要这样的分组/参数,那么就不要在模式中使用圆括号。所以要匹配
/static/index.html
,您可以:但您应该注意,如果您还有以下情况,则上述内容是多余的:
相关问题 更多 >
编程相关推荐