Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create table defined in sqlalchemy schema in the Heroku server?
    primarykey
    data
    text
    <p>I have a very simple app that I'm building with Python, SQLAlchemy, PostgreSQL and Turbogears 2.3.</p> <p>The app works in my local machine, where I use SQLite. However, when I upload it to Heroku, I don't know how to create there the PostgreSQL tables that TurboGears2 uses for authentication and validation: tables like User, Gruoups, Permissions.</p> <p>I see the schema is defined in a file called <code>auth.py</code> which looks like this:</p> <pre><code>.... from sqlalchemy import Table, ForeignKey, Column from sqlalchemy.types import Unicode, Integer, DateTime from sqlalchemy.orm import relation, synonym from example2.model import DeclarativeBase, metadata, DBSession class User(DeclarativeBase): __tablename__ = 'tg_user' user_id = Column(Integer, autoincrement=True, primary_key=True) user_name = Column(Unicode(16), unique=True, nullable=False) email_address = Column(Unicode(255), unique=True, nullable=False) display_name = Column(Unicode(255)) _password = Column('password', Unicode(128)) created = Column(DateTime, default=datetime.now) def __repr__(self): return '&lt;User: name=%s, email=%s, display=%s&gt;' % ( repr(self.user_name), repr(self.email_address), repr(self.display_name)) def __unicode__(self): return self.display_name or self.user_name ... </code></pre> <p>So my question is how can I create these tables automatically in the Heroku server? What commmand or script do I have to execute?</p> <p>Edit: Thanks to JPub's answer, I read on the docs, how to do it from console:</p> <pre><code>$ gearbox setup-app -c production.ini </code></pre> <p>And to do it in Heroku it should be:</p> <pre><code>$ heroku run 'gearbox setup-app -c production.ini' </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload