It seems "paster setup-app develpment.ini" is ignoring my data model.
In websetup.py we have...
def setup_app(command, conf, vars):
"""Place any commands to setup movie here"""
load_environment(conf.global_conf, conf.local_conf)
# Load the models
from movie import model
print "Creating tables"
model.metadata.create_all(bind=config['pylons.app_globals'].sa_engine)
In the wiki tute, we do...
print "Creating inital data"
page = model.Page("FrontPage", "initial data")
model.DBSession.add(page)
transaction.commit()
SA's metadata.create_all(engine) sounds like what I want, so why does
the create_all above not work? It comes from model.__init__.py where
we have
from sqlalchemy.ext.declarative import declarative_base
DeclarativeBase = declarative_base()
metadata = DeclarativeBase.metadata
create_all shows as an unresolved import and yet table 'pages' gets
created. I am importing my data model from model.py at the bottom of
model/__init__.py Is it necessary to create inital data as done above
for table 'pages' in order for the tables to be created in the first
place?
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.