我正在使用来自facebook 的龙卷风的演示
但我不想使用 MySQL 并试图用 PG 替换它所以我继续修改如下:
define("port", default=8888, help="run on the given port", type=int)
define("pgsql_host", default="127.0.0.1:5432", help="blog database host")
define("pgsql_database", default="pgdb", help="blog database name")
define("pgsql_user", default="admin", help="blog database user")
define("pgsql_password", default="pgpass", help="blog database password")
和
# Have one global connection to the blog DB across all handlers
self.db = tornado.database.Connection(
host=options.pgsql_host, database=options.pgsql_database,
user=options.pgsql_user, password=options.pgsql_password)
但是当我运行它时应用程序只是挂起,如何正确地将其迁移到 PG?
实际上我在一段时间后得到错误:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado-2.4.1-py2.7.egg/tornado/database.py", line 84, in __init__
self.reconnect()
File "/usr/local/lib/python2.7/dist-packages/tornado-2.4.1-py2.7.egg/tornado/database.py", line 101, in reconnect
self._db = MySQLdb.connect(**self._db_args)
File "/usr/lib/pymodules/python2.7/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 0")
为什么它连接到 MySQL?