On May 21, 2012, at 3:40 PM, Andrew wrote:
> I've put together a web2py skeleton for OpenShift PaaS
> (https://github.com/prelegalwonder/openshift_web2py) and am trying to tweak
> it for things like persisting sqlite through git pushes. In order to do that
> I need to change where web2py stores it's sqlite db files from
> applications/app/databases to the path of $OPENSHIFT_DATA_DIR. I'm looking
> at gluon/dal.py and I believe this is defined in the SQLiteAdapter class in
> the init function but I'm not clear how "databases" is getting appended to
> the path for where the sqlite file gets stored.
>
> Could anyone direct me to where this is happening or / and suggest a good way
> to externalize this so it's easier to define? This is really only an issue
> for sqlite but I'd like to make sure it's handled properly for people who are
> just getting started with web2py and might not be using things like mysql etc
> that would cause them to lose changes between git pushes since the persistent
> data wouldn't be saved to a persistent directory.
>
The default is set in gluon.compileapp.build_environment:
BaseAdapter.set_folder(os.path.join(request.folder, 'databases'))
It looks like you can override it with DAL(... folder=whatever ...)