[英]ImportError: No module named builtins - Google App Engine Standard - Django - Python 2.7
I'm trying to deploy an application and this error keeps coming up. 我正在尝试部署应用程序,并且此错误不断出现。 I am using the commands below in my views/models/form/settings.py, in order to use the same code I did for Python 3.
我在views / models / form / settings.py中使用以下命令,以使用与Python 3相同的代码。
from __future__ import absolute_import, division, print_function
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object)
I've already installed the library:future==0.16.0 on my requirements-vendor.txt 我已经在我的requirements-vendor.txt上安装了library:future == 0.16.0
On localhost I can run it, using a Conda Env (python 2.7) but the deployment on GAE(standard) I got the 500 Server Error. 在本地主机上,我可以使用Conda Env(python 2.7)运行它,但是在GAE(标准)上进行部署时,出现了500服务器错误。
App Engine Standard does not actually depends on a requirements.txt file for using third-party libraries, that's the case for App Engine Flexbile App Engine Standard实际上并不依赖于使用第三方库的requirements.txt文件, App Engine Flexbile就是这种情况
If you want to use a third-party library which is not in the list of already built-in libraries ( this list ) ,as in this case is future , you need to follow the Using third-party libraries for App Engine Standard docs , which was mentioned by @snakecharmerb. 如果您要使用不在内置库列表 ( 此列表 )中的第三方库(在这种情况下是将来的情况),则需要遵循“ 将第三方库用于App Engine标准”文档 , @snakecharmerb提到过。 Do the following n the same folder where you have your app.yaml file:
对您拥有app.yaml文件的同一文件夹执行以下操作:
Create a directory where your third-party-libraries will be stored: 创建一个目录,该目录将存储您的第三方库:
mkdir lib
Install library on the created folder: 在创建的文件夹上安装库:
pip install -t lib future==0.16.0
Create file named appengine_config.py
and add the following two lines to the file: 创建名为
appengine_config.py
文件,并将以下两行添加到文件中:
from google.appengine.ext import vendor
vendor.add('lib')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.