我正在尝试通过运行以下命令将PHP网站部署到Google App Engine:
appcfg.py -A <app-id> update <app-location>
我一直收到以下错误:
Traceback (most recent call last):
...
line 327, in __GetMimeTypeIfStaticFile
if re.match(regex, filename):
File "C:\python27\lib\re.py", line 137, in match
return _compile(pattern, flags).match(string)
File "C:\python27\lib\re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: bogus escape: '\\1'
我不确定是否存在Python无法识别的MIME类型,或者Google是否阻止了某些文件。我试图浏览部署代码,但是有大量的参考资料我不得不追逐。有没有人有任何想法?
完整堆栈跟踪:
Traceback (most recent call last):
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform/google_appengine\appcfg.py", line 133, in <module>
run_file(__file__, globals())
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform/google_appengine\appcfg.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 5511, in <module>
main(sys.argv)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 5502, in main
result = AppCfgApp(argv).Run()
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 3021, in Run
self.action(self)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 5158, in __call__
return method()
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 3880, in Update
self._UpdateWithParsedAppYaml(appyaml, self.basepath)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 3933, in _UpdateWithParsedAppYaml
self.UpdateVersion(rpcserver, basepath, appyaml, APP_YAML_FILENAME)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 3818, in UpdateVersion
return appversion.DoUpload(paths, openfunc)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 2441, in DoUpload
self._AddFilesThatAreSmallEnough(paths, openfunc)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 2540, in _AddFilesThatAreSmallEnough
self.config, path, self.error_fh)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 298, in __init__
self.__static_mime_type = self.__GetMimeTypeIfStaticFile(config, filename)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py",
line 327, in __GetMimeTypeIfStaticFile
if re.match(regex, filename):
File "C:\python27\lib\re.py", line 137, in match
return _compile(pattern, flags).match(string)
File "C:\python27\lib\re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: bogus escape: '\\1'
以下是我的app.yaml文件的内容:
application: <app-id>
version: 1
runtime: php55
api_version: 1
threadsafe: yes
handlers:
- url: /(.*\.(css|js|png|jpg|jpeg|ttf|woff|xsl|htm|html|ico).*)$
static_files: \1
upload: \1
- url: /(.+\.php)$
script: \1
- url: /(.+)/$
script: \1/default.php
- url: /(.+)$
script: \1.php
- url: /|/default.php
script: default.php
答案 0 :(得分:3)
您不能使用匹配的组(\1
)作为静态处理程序的upload:
部分的值 - 它需要准确知道要上传到静态服务器的文件