I'm experimentation with a brand new blog database design and you will find some tests I must run in web2py's administrative interface.

  • I began by developing a new web2py application known as newblog from web2py's admin interface.
  • Next, I produced newblog/models/appdb.py, below
  • I Quickly surfed towards the admin interface at to guarantee the database was produced
  • I checked the filesystem and databases/newblog.db includes a completely new creation time
  • I clicked on with the appadmin menu to determine my new database: "web2py" > "This Application" > "Database"

Problem: The issue is I do not view it within the database admin interface for newblog. I've come across other empty web2py databases displayed within the appadmin interface, and so i do not understand why mine doesn't show available online for.

Question: Is expected behavior? If that's the case, do you know the minimal steps I have to require my web2py database to appear in appadmin?

def build_new_table():
    return dict({'ugly_dict': 42})

db = DAL('sqlite://newblog.db')

## Build a table of tables, by the type of table (i.e. post, code, etc)
    Field('name', length=32, notnull=True, unique=True,
        comment="Name of the database table"),

    #IS_IN_DB(db, 'db.%s.name' % db.db_type.name)),
    Field('database_pointer', notnull=True, unique=True,
        comment="Reference to the database table identified by 'name'",

## Define tags for the database items
    Field('name', length=32, notnull=True, unique=True),

It may sound like you will find the default db.py file additionally for your custom appdb.py file. Note, model files are performed from a to z, so db.py is performed after your file. db.py assigns another database link with the variable db, so that database is turning up in appadmin. You need to either make use of the same database for teams of tables, or use variables for that two database connection objects. For instance, in appdb.py, you may do:

blogdb = DAL('sqlite:\\newblog.db')

If you wish to make use of the same database for those tables, then just define your DAL object within the first file (within this situation, appdb.py), and you will make reference to it in most subsequent model files (don't redefine it).