Search code examples
pythonherokutornado

tornado.database Importerror: No module named database


I'm using a fork of Bret Taylor's 'socialcookbook' (https://github.com/finiteloop/socialcookbook) which uses "import tornado.database" - and it's worked perfectly until yesterday (the 3.01 build?) and now I'm getting an ImportError: no module named database when I compile on Heroku (using Python).

My requirements.txt file is simple:

mysql-python
tornado

My import statements:

import base64
import datetime
import functools
import json
import hashlib
import hmac
import time
import logging
import os
import smtplib #for mandrill email notifications
import httplib #for custom error handler
import re
import string
import tornado.database
import tornado.escape
import tornado.httpclient
import tornado.ioloop
import tornado.web
import urllib
import urllib2
import urlparse
from tornado.options import define, options
import facebook

Any thoughts? I'm having a hard time troubleshooting this one and I can't push new builds (old builds work fine if I rollback on Heroku, though, oddly..)


Solution

  • As it turns out, Tornado 3.0 has deprecated tornado.database and replace it with torndb: https://github.com/bdarnell/torndb

    So the fix is to simply replace all tornado.database references with torndb and add torndb to the requirements.txt file.