import sys
sys.path.append("c:/web2py")
from gluon import *

db = DAL('sqlite://...', folder="c:/web2py/applications/crm/
models",auto_import=True)

result = db(db["customer"]).select()
print(result)

On Jun 6, 2:05 pm, apple <simo...@gmail.com> wrote:
> I would like to be able to use the DAL to run standalone scripts to
> query a database. I have managed to get this working by adding a "from
> gluon import *" to mymodel and running the code below:
>
> import sys
> sys.path.append("c:/web2py")
> sys.path.append("c:/web2py/applications/crm/models")
> from gluon import *
> from mymodel import *
> result = db(db["customer"]).select()
> print(result)
>
> However if there is a reference to auth then I need to also change
> mymodel to include:
>       from gluon.tools import *
>       auth = Auth(globals(),db)
> This fails because there is no request. Is there a way round this to
> make web2py think it is running a server?

Reply via email to