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.

Den måndag 6 april 2020 kl. 11:51:12 UTC+2 skrev Val K:
>
> You can save any object in the module or current, but if you use more than 
> one worker you will have independent instance of that object per worker

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b1881422-5a42-4fb3-9efd-7b8de6ae5bf2%40googlegroups.com.

Reply via email to