如何在Google App Engine的本地开发服务器上使用Python 3 [英] How to use Python 3 with Google App Engine's Local Development Server

查看:126
本文介绍了如何在Google App Engine的本地开发服务器上使用Python 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经配置了一个本地Python应用程序

I've got a local Python application configured with

runtime: python

在它的app.yaml文件中.使用

dev_appserver.py app.yaml

一切都很好.

由于GAE的本地开发服务器默认使用Python2.7,因此我现在想使用Python3.x.根据Google的文档,我们必须使用灵活的环境.因此,我将app.yaml更改为:

Since GAE's Local Development Server uses Python2.7 by default, I now want to make use of Python3.x instead. According to Google's documentation, we have to use the flexible environment. Thus I'm changing app.yaml to:

runtime: python
env: flex

runtime_config:
  python_version: 3

现在dev_appserver.py app.yaml退出:

Under dev_appserver, runtime:python is not supported for Flexible environment.

可以使用 Google的Hello World应用程序重现该问题也使用灵活的环境.

The problem can be reproduced with Google's Hello World application that uses the flexible environment as well.

所以在本地我们不能使用Python3?在上传之前,我们如何在本地运行我的Python3代码?

So locally we can't use Python3? How can we then run my Python3 code locally before uploading it?

推荐答案

Using the Local Development Server is applicable to the first generation standard environment apps only.

有关运行本地灵活的env应用程序的信息,请参见

For running locally flexible env apps see Running locally:

您可以使用本机开发工具在本地运行应用程序 您通常使用的.

You run your application locally with the native development tools that you usually use.

例如,您通常可以使用Flask的 开发服务器使用:

For example, you can usually run a Flask application with Flask's development server using:

python main.py

可以使用以下命令启动Django应用程序:

Django applications can be started using:

python manage.py runserver

相关: 更新:

对第二代标准环境的支持是有限的,请参见

Support for the 2nd generation standard environment is limited, see Python 3.7 Local Development Server Options for new app engine apps

这篇关于如何在Google App Engine的本地开发服务器上使用Python 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆