带有Google App Engine的Python(Flask)。 AttributeError:“模块”对象没有属性“ lru_cache”

时间:2019-01-23 18:19:48

标签: python google-app-engine flask jinja2

我正在尝试使用Python和Flask将网络应用程序部署到Google App Engine。 当我在本地主机上检查我的应用程序时,它运行良好,但是当我部署它并转到GAE生成的链接时,出现服务器500错误。

这是我在错误日志中看到的:

Traceback (most recent call last):
  File "/base/alloc/tmpfs/dynamic_runtimes/python27g/350d926c06a7e859/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/alloc/tmpfs/dynamic_runtimes/python27g/350d926c06a7e859/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/alloc/tmpfs/dynamic_runtimes/python27g/350d926c06a7e859/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/base/data/home/apps/j~trial1-ak/20190123t212940.415607737396553406/main.py", line 1, in <module>
    from flask import Flask, flash, redirect, render_template, request, url_for
  File "/base/data/home/apps/j~trial1-ak/20190123t212940.415607737396553406/lib/flask/__init__.py", line 19, in <module>
    from jinja2 import Markup, escape
  File "/base/data/home/apps/j~trial1-ak/20190123t212940.415607737396553406/lib/jinja2/__init__.py", line 41, in <module>
    from jinja2.bccache import BytecodeCache, FileSystemBytecodeCache, \
  File "/base/data/home/apps/j~trial1-ak/20190123t212940.415607737396553406/lib/jinja2/bccache.py", line 24, in <module>
    import fnmatch
  File "/base/data/home/apps/j~trial1-ak/20190123t212940.415607737396553406/lib/fnmatch.py", line 38, in <module>
    @functools.lru_cache(maxsize=256, typed=True)
AttributeError: 'module' object has no attribute 'lru_cache'

我为该应用安装的软件包列表为:

Flask==0.12.3
click==6.7
gunicorn==19.7.1
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
pytz==2017.2
requests==2.13.0
Werkzeug==0.12.1

有人可以告诉我如何解决此问题吗?

谢谢。

0 个答案:

没有答案