无法使用Postgresql数据库运行web2py计划程序 [英] Can not run the web2py scheduler using postgresql database
问题描述
我可以使用sqlite数据库运行调度程序,但是当我改用postgres数据库时会出现错误。
I can run the scheduler using sqlite database, but I will got the error when I change to using postgres database.
代码(task.py):
Code (task.py):
def AutoRemoveCacheData():
return 'OK'
from gluon.scheduler import Scheduler
scheduler = Scheduler(db,dict(AutoRemoveCacheData=AutoRemoveCacheData),migrate=True)
错误消息:
root@ip-123-45-67-321:/var/www/web2py# python web2py.py -K ScheduleApp
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2015
Version 2.9.11-stable+timestamp.2014.09.15.23.35.11
Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib)
starting single-scheduler for "ScheduleApp"...
ERROR:web2py.scheduler.ip-123-45-67-321#1388:Error retrieving status
ERROR:web2py.scheduler.ip-123-45-67-321#1388:Error retrieving status
ERROR:web2py.scheduler.ip-123-45-67-321#1388:Error retrieving status
有人知道如何解决此问题吗?
Anybody know how to solve this problem?
谢谢!
推荐答案
我遇到了相同的错误。
- 开发环境:Windows版本的web2py(包括Web服务器和sqlite)
- 生产环境:web2py与Linux Web服务器和PostgreSQL上的Apache绑定。
要获取实际的错误原因,我调整了 gluon / scheduler.py
。删除有罪的try / Scheduler.send_heartbeat()例外后,出现以下错误: NotSupportedError:类型oid 114没有映射到py类型
To get the actual error cause, I tweaked gluon/scheduler.py
. After removing the guilty try/except of Scheduler.send_heartbeat() I got the following error: NotSupportedError: type oid 114 not mapped to py type
在这个错误中徘徊,我发现了那个讨论 Niphlod表示: 问题来自pg8000不支持json类型。请改用psycopg2 。
Googling around with this error I found that discussion where Niphlod says: "The problem comes from pg8000 not supporting the json type. Use psycopg2 instead."
因此,让我们尝试使用此Python模块...
So, let's try with this Python module...
这篇关于无法使用Postgresql数据库运行web2py计划程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!