First, defining the models in __init__.py is poor practice, so why does the 
tutorial do it?  It should describe how to create a separate models.py file.

Second - and this is my biggest pet peeve since coming to the python world - 
when writing a tutorial for the love of god please INCLUDE THE IMPORT 
STATEMENTS.  Really, I spend more time grepping for how to import stuff than 
anything else in python.  

OK, I feel better now.

I'm trying to follow the feature server tutorial and I find that running paster 
setup-app does not generate my tables.  It makes the user tables and security 
stuff ,but the not the roads table.

I defined models.py and put this in it:

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relation, backref
from sqlalchemy import Column, Integer, Unicode, DateTime, ForeignKey
from geoalchemy import GeometryColumn, Point
from geoalchemy import GeometryDDL
from datetime   import datetime

DeclarativeBase = declarative_base()

class Road(DeclarativeBase):
    __tablename__ = 'roads'
    id = Column(Integer, primary_key=True)
    name = Column(Unicode, nullable=False)
    width = Column(Integer)
    created = Column(DateTime, default=datetime.now())
    geom = GeometryColumn(LineString(2))

GeometryDDL(Road.__table__)

Then in __init__.py I added the line at the bottom:

from eagle.model.models import Road

Running paster setup-app development.ini generates all the user/groups tables 
as expected but it does not create the 'roads' table.
Why not?

Thanks,
-Todd Blanchard

--

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.


Reply via email to