gpt4 book ai didi

python - dev_appserver 无法在 Ubuntu docker 容器上启动(ValidationError : Value 'None' for application does not match expression)

转载 作者:太空宇宙 更新时间:2023-11-03 14:05:10 24 4
gpt4 key购买 nike

我在升级 docker 容器后开始看到这个问题。我找不到将旧包用于 App Engine 的方法。使用选项 =157.x.y 获取旧版本在 apt-get 中不起作用。

失败日志:

Traceback (most recent call last):
File "/usr/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 103, in <module>
_run_file(__file__, globals())
File "/usr/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 97, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 322, in <module>
main()
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 310, in main
dev_server.start(options)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 106, in start
env_variables=parsed_env_variables)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 851, in __init__
env_variables)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 131, in __init__
self._config_path)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 443, in _parse_configuration
config.application = self._forced_app_id
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/validation.py", line 361, in __setattr__
value = self.GetValidator(key)(value, key)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/validation.py", line 599, in __call__
return self.Validate(value, key)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/validation.py", line 881, in Validate
return self.validator(value, key)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/validation.py", line 599, in __call__
return self.Validate(value, key)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/validation.py", line 955, in Validate
'\'%s\'' % (value, key, self.re.pattern))
google.appengine.api.validation.ValidationError: Value 'None' for application does not match expression '^(?:(?:[a-z\d\-]{1,100}\~)?(?:(?!\-)[a-z\d\-\.]{1,100}:)?(?!-)[a-z\d\-]{0,99}[a-z\d])$'

Docker 文件

    FROM ubuntu:16.04
RUN apt-get upgrade
RUN apt-get update

RUN apt-get install -y wget
RUN apt-get install -y curl
RUN apt-get install -y apt-transport-https

RUN echo "deb https://packages.cloud.google.com/apt cloud-sdk-xenial main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

RUN wget -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

RUN apt-get update
RUN cat /etc/apt/sources.list.d/google-cloud-sdk.list

RUN apt-get install -y google-cloud-sdk
RUN apt-get install -y google-cloud-sdk-app-engine-python

WORKDIR /mycodepath
EXPOSE 8080

最佳答案

我的 dev_appserver 版本开始做同样的事情。

我深入研究了代码,发现参数解析器将一个空的 app_id 命令行参数设置为 "None"(是的,这是一个 String 而不是 NoneType)。顺便说一句,app_id 正则表达式不匹配大写字符,因此会触发 ValidationError。 (我很高兴是这种情况,否则它会通过默默地将我的应用程序名称设置为“无”而导致更棘手的错误)

我现在的解决方法是使用 -A 标志从命令行显式传递您的应用程序的名称。请注意,这会覆盖 app.yaml 配置中的 application 变量。

我以为我的 argparse 版本坏了,但现在听起来像是一个 dev_appserver 错误。

关于python - dev_appserver 无法在 Ubuntu docker 容器上启动(ValidationError : Value 'None' for application does not match expression),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44363876/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com