【问题标题】:Google Appengine / Django / NDB setup throws mysqldb error on server startGoogle Appengine / Django / NDB 设置在服务器启动时引发 mysqldb 错误
【发布时间】:2012-12-14 16:37:03
【问题描述】:

我在 OSX Mountain Lion 上使用 python 2.7 在 vi​​rtualenv 中运行 Django 1.3。当我运行 dev_appserver.py 时,我遇到了这个问题。 (忽略images API的警告。

问题:为什么我在使用 ndb 时会收到 mysqldb 警告?

问题:我需要对警告做些什么吗?

这是我第一次使用 Python、Django 和 AppEngine,所以我不知道我在设置过程中是否做错了什么。我没有对数据库做任何事情(例如syncdb

WARNING  2012-12-29 21:05:26,272 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded.
INFO     2012-12-29 21:05:26,356 appcfg.py:586] Checking for updates to the SDK.
INFO     2012-12-29 21:05:26,795 appcfg.py:604] The SDK is up to date.
WARNING  2012-12-29 21:05:26,795 dev_appserver.py:3571] The datastore file stub is deprecated, and
will stop being the default in a future release.
Append the --use_sqlite flag to use the new SQLite stub.

You can port your existing data using the --port_sqlite_data flag or
purge your previous test data with --clear_datastore.

WARNING  2012-12-29 21:05:26,795 datastore_file_stub.py:518] Could not read datastore data from /var/folders/92/tl1hq8ps1v18n1m68s6fxkp00000gn/T/dev_appserver.datastore
WARNING  2012-12-29 21:05:26,797 dev_appserver.py:3670] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO     2012-12-29 21:05:26,802 dev_appserver_multiprocess.py:655] Running application dev~google-solveforx on port 8080: http://localhost:8080
INFO     2012-12-29 21:05:26,802 dev_appserver_multiprocess.py:657] Admin console is available at: http://localhost:8080/_ah/admin

app.yaml

application: appname
version: staging
runtime: python27
api_version: 1
threadsafe: false

main.py

import os
from django.core.handlers import wsgi
from google.appengine.ext import ndb

os.environ['DJANGO_SETTINGS_MODULE'] = 'appname.settings'

# Wrapping the WSGI application in ndb.toplevel ensures that all async
# operations complete before returning.
application = ndb.toplevel(wsgi.WSGIHandler())

settings.py

import os

DEBUG = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev')

ROOT_URLCONF = 'solveforx.urls'

MIDDLEWARE_BASE = 'solveforx.lib.middleware'

MIDDLEWARE_CLASSES = (
    'django.middleware.csrf.CsrfViewMiddleware',
    '%s.SecurityMiddleware' % MIDDLEWARE_BASE,
    '%s.TemplateContext' % MIDDLEWARE_BASE,
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.csrf',
    'django.core.context_processors.request',
)

# By default django will load the templates under templates/ directory under
# every installed apps.
INSTALLED_APPS = (
    'appname.frontend',
)

【问题讨论】:

  • 应用程序在本地还能运行吗?我认为 Mysql 错误与 Django 有关,但它不应该影响您的应用程序
  • 该应用程序仍然可以在本地运行,但我没有收到任何数据。老实说,我也不确定我是否有任何数据。将关闭此 Q 以获得@johnlockwood 的答案。

标签: django google-app-engine app-engine-ndb


【解决方案1】:

如果您打算使用 Cloud SQL,则只需要 Mysqldb。 https://developers.google.com/cloud-sql/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-20
    • 2021-04-20
    • 2013-10-28
    • 2014-11-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多