Did this in the top of a controller:
from gluon import current
try:
if current.ts_db is not None:
Databases.setTSDB(current.ts_db)
except AttributeError:
current.ts_db = Databases.setTSDB()
Databases is a model and setTSDB looks liks this:
@staticmethod
def setTSDB(db = None):
if db is None:
logger.debug("Creating new TS DB")
db = CassandraConnection([TS_DB_URL], TS_DB_PORT)
DriverFactory.setDB(db)
return db
Whenever I make a request I get the "Creating new TS DB" log so the object doesn't seem to be saved. Any ideas why?
I should mention that I'm running web2py behind Apache with mod_wsgi.