gpt4 book ai didi

python - 谷歌应用引擎+python(django)部署错误: Error loading MySQLdb module

转载 作者:太空宇宙 更新时间:2023-11-03 12:49:47 25 4
gpt4 key购买 nike

我正在 Google App Engine 上创建一个应用程序。我正在使用 Django 1.4 和 Python 2.7。在本地主机上一切正常。但是在部署之后它没有运行,我一直在管理日志中看到这个:

    2012-12-15 15:02:41.870

/base/python27_runtime/python27_lib/versions/1/lib/cacerts/urlfetch_cacerts.txt missing; without this urlfetch will not be able to validate SSL certificates.

W 2012-12-15 15:02:41.870

No ssl package found. urlfetch will not be able to validate SSL certificates.

E 2012-12-15 15:02:46.086

Traceback (most recent call last):
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 266, in _LoadHandler
__import__(cumulative_path)
File "/base/data/home/apps/s~cloudwallforever/1.363864476397206865/djangoappengine/main/__init__.py", line 28, in <module>
setup_env()
File "/base/data/home/apps/s~cloudwallforever/1.363864476397206865/djangoappengine/boot.py", line 82, in setup_env
setup_logging()
File "/base/data/home/apps/s~cloudwallforever/1.363864476397206865/djangoappengine/boot.py", line 130, in setup_logging
if not settings.DEBUG:
File "/base/data/home/apps/s~cloudwallforever/1.363864476397206865/django/utils/functional.py", line 276, in __getattr__
self._setup()
File "/base/data/home/apps/s~cloudwallforever/1.363864476397206865/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/base/data/home/apps/s~cloudwallforever/1.363864476397206865/django/conf/__init__.py", line 87, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/base/data/home/apps/s~cloudwallforever/1.363864476397206865/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/base/data/home/apps/s~cloudwallforever/1.363864476397206865/settings.py", line 6, in <module>
import django.db.backends.mysql.base
File "/base/data/home/apps/s~cloudwallforever/1.363864476397206865/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

知道为什么会这样吗?

最佳答案

“Django 支持”文档暗示了解决方案,但没有明确说明:

Since the standard django.db.backends.mysql backend uses MySQLdb internally, app.yaml must reference MySQLdb in the list of libraries.

将以下内容添加到 app.yaml 似乎可以修复 ImportError:

libraries:
- name: MySQLdb
version: "latest"

请注意,MySQLdb 当前未包含在 available third party libraries 的列表中.我一时兴起尝试了一下,它似乎为我解决了这个问题,YMMV。 enter link description here

关于python - 谷歌应用引擎+python(django)部署错误: Error loading MySQLdb module,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13892730/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com