以下代码应该input.html显示2个日期并显示月份和年份output.html,但Google应用引擎会返回错误,说明缺少模块6,即使我已在项目库中添加了所有网站包.
我究竟做错了什么?
import webapp2
import jinja2
import os
import time
import datetime
import sys
from dateutil.rrule import rrule, MONTHLY
sys.path.append(os.path.join(os.path.dirname(__file__), "libs"))
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir),
autoescape = True)
def render_str(template, **params):
t = jinja_env.get_template(template)
return t.render(params)
class MainHandler(webapp2.RequestHandler):
def write(self, *a, **kw):
self.response.out.write(*a, **kw)
def render_str(self, template, **params):
return render_str(template, **params)
def render(self, template, **kw):
self.write(self.render_str(template, **kw))
def get(self):
self.render('input.html')
def post(self):
frmstring=self.request.get('from')
tostring=self.request.get('to')
frm=time.strptime(frms,"%Y-%m")
to=time.strptime(tos,"%Y-%m")
dates = [dt for dt …Run Code Online (Sandbox Code Playgroud) 我使用本教程https://cloud.google.com/appengine/docs/flexible/python/hello-world创建简单的hello world应用程序, 并尝试使用控制台部署应用程序
gcloud config set project [myId]
gcloud config set account xxxx@gmail.com
cloud preview app deploy app.yaml
Run Code Online (Sandbox Code Playgroud)
在结束控制台写错误
错误响应:[13]启动VM时超时.应用程序代码可能不健康.(0/2准备好,2仍然部署).
I have a number of projects deployed to Python 2 Standard environment in Google App Engine and started to worry what will happen after January 1, 2020 when Python 2 will become not maintained.
Does Google provide some hints if it's going to keep Python 2 Standard environment in App Engine for a long time? Or should I start migrating? In some projects migration is going to be painful due to ndb and other google libraries, which are not supported …
python google-app-engine python-2.7 google-app-engine-python
在过去的几天里,每当我跑步时,这已经开始出现dev_appserver.py:
from google.appengine.tools.devappserver2.python import sandbox
ImportError: cannot import name sandbox
Run Code Online (Sandbox Code Playgroud)
由于我在新环境的设置中主要遇到这个问题,我认为在安装过程中我一定是个错误.在过去3个小时内经过足够的头部刮擦后,我认为它不能出现在新设置中,所以我加载dev_appserver.py到一个已知的工作环境中.
再次:
from google.appengine.tools.devappserver2.python import sandbox
ImportError: cannot import name sandbox
Run Code Online (Sandbox Code Playgroud)
我的应用程序代码都没有被更改,因此它必须是其他内容.
如果我在 GCE 中使用来自 Bitnami 的 ElasticSearch 图像,我是否需要一个单独的Memcached 虚拟机,或者最好通过其他方式(在客户端本地或通过 Web 缓存)甚至内置于 ElasticSearch 中使用 Memcached 进行缓存?我是否应该在类似于此示例的 appengine 灵活环境中的 docker 容器中使用 Elasticsearch 和 Memcached 来扩展运行时?
背景是我想升级最初是python2.7 google appengine webapp的项目,但是python3版本的google appengine for python已经弃用了memcached API和ndb search API,所以我正在考虑是否使用实例在带有 ElasticSearch 和/或 Memcached 的 GCE 中,我可以在 python3.8 appengine webapp 和运行 ElasticSearch 的某个实例之间划分服务。我试过了,这是一次很好的体验。
我还准备考虑除 ElasticSearch 之外的其他替代方案(Web UI 是使用语义 UI和自定义 JS 创建的)。迁移从用户模型远webapp2的,我们要利用火力进行用户认证,并保持了Python应用程序引擎,NDB现在,但我们正在考虑从NDB模型移开,因为我们存储的主要数据为用户配置文件(现在可以存储在 Firebase 中)和短期数据(保存在 appengine 数据存储中)。如果这个项目是今天从头开始创建的,我可能会使用 Firebase 来处理所有事情,并通过 API 从前端层直接连接到它,但我明白如果我使用 Firebase
bitnami elasticsearch google-compute-engine google-cloud-platform google-app-engine-python