Web2py DAL From Python Shell

When you want to test your web2py DAL code from a standard python prompt, here are some useful snippets. Of course, you can always use the web2py console instead.

[foobar@mybox]# python

>>> import sys
>>> from gluon.dal import DAL
>>> from gluon.dal import Field
>>> sys.path.append('/web2py-parent-folder/web2py')
>>> db = DAL(yourConnectionString, folder=yourApplicationDatabaseFolder)
>>> db.define_table( ...

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *