Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine OGLE应用程序引擎标准环境中的Gunicorn命令行错误_Google App Engine_Google Cloud Platform_Gunicorn - Fatal编程技术网

Google app engine OGLE应用程序引擎标准环境中的Gunicorn命令行错误

Google app engine OGLE应用程序引擎标准环境中的Gunicorn命令行错误,google-app-engine,google-cloud-platform,gunicorn,Google App Engine,Google Cloud Platform,Gunicorn,在将Flask/Python3/Postgres应用程序部署到应用程序引擎标准环境之后,我遇到了无数的以下错误。关于Psycopg2软件包的警告值得关注,但不是什么原因导致应用程序无法运行。相反,gunicorn的无效命令行参数是由GAE提供的,而不是由我提供的。有人能够成功地将使用Postgres的Python3烧瓶部署到标准环境中吗 以下是日志文件输出: 2018-12-11 02:51:37 +0000] [3738] [INFO] Booting worker with pid: 373

在将Flask/Python3/Postgres应用程序部署到应用程序引擎标准环境之后,我遇到了无数的以下错误。关于Psycopg2软件包的警告值得关注,但不是什么原因导致应用程序无法运行。相反,gunicorn的无效命令行参数是由GAE提供的,而不是由我提供的。有人能够成功地将使用Postgres的Python3烧瓶部署到标准环境中吗

以下是日志文件输出:

2018-12-11 02:51:37 +0000] [3738] [INFO] Booting worker with pid: 3738
2018-12-11 02:51:37 default[20181210t140744]  /env/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2018-12-11 02:51:37 default[20181210t140744]    """)
2018-12-11 02:51:38 default[20181210t211942]  usage: gunicorn [-h] [--debug] [--args]
2018-12-11 02:51:38 default[20181210t211942]  gunicorn: error: unrecognized arguments: main:app --workers 1 -c /config/gunicorn.py
2018-12-11 02:51:38 default[20181210t211942]  [2018-12-11 02:51:38 +0000] [882] [INFO] Worker exiting (pid: 882)
2018-12-11 02:51:37+0000][3738][INFO]带pid的引导工人:3738
2018-12-11 02:51:37默认值[20181210t140744]/env/lib/python3.7/site packages/psycopg2/__init__.py:144:UserWarning:psycopg2轮子包将从2.8版重命名;为了保持从二进制文件安装,请改用“pip安装psycopg2二进制文件”。有关详细信息,请参阅:。
2018-12-11 02:51:37默认值[20181210t140744]“”)
2018-12-11 02:51:38默认[20181210t211942]用法:gunicorn[-h][--debug][--args]
2018-12-11 02:51:38默认值[20181210t211942]gunicorn:错误:无法识别的参数:main:app--workers 1-c/config/gunicorn.py
2018-12-11 02:51:38默认值[20181210t211942][2018-12-11 02:51:38+0000][882][INFO]工人退出(pid:882)

默认情况下,如果app.yaml中未定义
entrypoint
,app Engine将在
main.py
中查找名为
app
的应用程序。如果在中查看官方代码示例,它将在main.py文件中声明:

app = Flask(__name__)
或者,也可以通过向app.yaml添加指向另一个文件的
入口点来配置。例如,如果在名为prod的文件中声明app:

entrypoint: gunicorn -b :$PORT prod.app

您将找到有关入口点配置的其他详细信息。

从上面的评论和回答来看,问题似乎出现在我的应用程序中。我通过在裸体应用程序上本地运行gunicorn确认了这一点,但在运行真正的应用程序时失败了

一个罪魁祸首是使用argparse,我使用它是为了在本地工作时可以在命令行中添加一个“debug”参数。将该代码移动到
if uuuu name_uuu=='uu main_uu':
部分可以使应用程序在本地使用gunicorn时运行良好

但部署到GAE时仍然失败:

2018-12-12 20:09:16 default[20181212t094625]  [2018-12-12 20:09:16 +0000] [8145] [INFO] Booting worker with pid: 8145
2018-12-12 20:09:16 default[20181212t094625]  /env/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2018-12-12 20:09:16 default[20181212t094625]    """)
2018-12-12 20:09:16 default[20181212t094625]  [2018-12-12 20:09:16 +0000] [8286] [INFO] Booting worker with pid: 8286
2018-12-12 20:09:16 default[20181212t094625]  /env/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2018-12-12 20:09:16 default[20181212t094625]    """)
2018-12-12 20:09:19 default[20181212t094625]  usage: gunicorn [-h] [--debug] [--args]
2018-12-12 20:09:19 default[20181212t094625]  gunicorn: error: unrecognized arguments: -b :8081 main:app
2018-12-12 20:09:19 default[20181212t094625]  [2018-12-12 20:09:19 +0000] [8145] [INFO] Worker exiting (pid: 8145)

你能显示你的
app.yaml
文件吗?里面有
entrypoint
吗?
runtime: python37
env: standard
#threadsafe: true
entrypoint: gunicorn --workers 2 --bind :5000 main:app

#runtime_config:
#  python_version: 3

# This beta setting is necessary for the db hostname parameter to be able to handle a URI in the
# form “/cloudsql/...” where ... is the instance given here:
beta_settings:
    cloud_sql_instances: provost-access-148820:us-east1:cuny-courses