Can not run the web2py scheduler using postgresql database

百般思念 提交于 2019-12-23 02:14:32

问题


I can run the scheduler using sqlite database, but I will got the error when I change to using postgres database.

Code (task.py):

def AutoRemoveCacheData():
    return 'OK'

from gluon.scheduler import Scheduler
scheduler = Scheduler(db,dict(AutoRemoveCacheData=AutoRemoveCacheData),migrate=True)

Error message:

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?

Thanks!


回答1:


I'm having the same error.

  • Development environment: windows version of web2py w/ included web server and sqlite
  • Production environment: web2py tied to Apache on Linux web server and PostgreSQL.

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

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."

So, let's try with this Python module...



来源:https://stackoverflow.com/questions/28169849/can-not-run-the-web2py-scheduler-using-postgresql-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!