Re: [web2py] migratin apps
Thanks On 05/09/2010 12:06 AM, Thadeus Burgess wrote: Your tables already exist in the database. However you must have deleted your /app/databases/*.table files, so as far as web2py is concerned it is a blank database. To remedy the solution, add this to each of your define table statements db.define_table('.', fake_migrate=True) Run your code once, this should create the needed app/databases/*.table files, then remove th fake_migrate lines and you should be all set. -- Thadeus On Sat, May 8, 2010 at 4:52 PM, Tomas Pelka wrote: Hi all, is there any advice how to migrate my web2py application. I have shared postgress db. When I start up new instance (simple copied) of my app, I always get following traceback: Traceback (most recent call last): File "/home/tom/web2py/gluon/restricted.py", line 178, in restricted exec ccode in environment File "/home/tom/web2py/applications/init/models/db.py", line 32, in auth.define_tables() # creates all needed tables File "/home/tom/web2py/gluon/tools.py", line 829, in define_tables format='%(first_name)s %(last_name)s (%(id)s)') File "/home/tom/web2py/gluon/sql.py", line 1303, in define_table t._create(migrate=migrate, fake_migrate=fake_migrate) File "/home/tom/web2py/gluon/sql.py", line 1724, in _create self._db._execute(query) File "/home/tom/web2py/gluon/sql.py", line 958, in self._execute = lambda *a, **b: self._cursor.execute(*a, **b) ProgrammingError: relation "auth_user" already exists Seems that web2py do not establish db connection properly. For example always when I want get something from bd: Traceback (most recent call last): File "/home/tom/web2py/gluon/restricted.py", line 178, in restricted exec ccode in environment File "/home/tom/web2py/applications/NetSim/controllers/analyze.py", line 167, in File "/home/tom/web2py/gluon/globals.py", line 96, in self._caller = lambda f: f() File "/home/tom/web2py/applications/NetSim/controllers/analyze.py", line 127, in index ifaces = db().select(db.interfaces.ALL) File "/home/tom/web2py/gluon/sql.py", line 1323, in __getattr__ return dict.__getitem__(self,key) KeyError: 'interfaces' But tabele "interfaces" is in bd. Thanks for comments Cheers Tom -- Tomas Pelka -- Tomas Pelka
Re: [web2py] migratin apps
Your tables already exist in the database. However you must have deleted your /app/databases/*.table files, so as far as web2py is concerned it is a blank database. To remedy the solution, add this to each of your define table statements db.define_table('.', fake_migrate=True) Run your code once, this should create the needed app/databases/*.table files, then remove th fake_migrate lines and you should be all set. -- Thadeus On Sat, May 8, 2010 at 4:52 PM, Tomas Pelka wrote: > Hi all, > is there any advice how to migrate my web2py application. I have shared > postgress db. When I start up new instance (simple copied) of my app, I > always get following traceback: > > Traceback (most recent call last): > File "/home/tom/web2py/gluon/restricted.py", line 178, in restricted > exec ccode in environment > File "/home/tom/web2py/applications/init/models/db.py", line 32, in > > auth.define_tables() # creates all needed tables > File "/home/tom/web2py/gluon/tools.py", line 829, in define_tables > format='%(first_name)s %(last_name)s (%(id)s)') > File "/home/tom/web2py/gluon/sql.py", line 1303, in define_table > t._create(migrate=migrate, fake_migrate=fake_migrate) > File "/home/tom/web2py/gluon/sql.py", line 1724, in _create > self._db._execute(query) > File "/home/tom/web2py/gluon/sql.py", line 958, in > self._execute = lambda *a, **b: self._cursor.execute(*a, **b) > ProgrammingError: relation "auth_user" already exists > > Seems that web2py do not establish db connection properly. For example > always when I want get something from bd: > > Traceback (most recent call last): > File "/home/tom/web2py/gluon/restricted.py", line 178, in restricted > exec ccode in environment > File "/home/tom/web2py/applications/NetSim/controllers/analyze.py", line > 167, in > File "/home/tom/web2py/gluon/globals.py", line 96, in > self._caller = lambda f: f() > File "/home/tom/web2py/applications/NetSim/controllers/analyze.py", line > 127, in index > ifaces = db().select(db.interfaces.ALL) > File "/home/tom/web2py/gluon/sql.py", line 1323, in __getattr__ > return dict.__getitem__(self,key) > KeyError: 'interfaces' > > But tabele "interfaces" is in bd. > > Thanks for comments > Cheers Tom > > -- > Tomas Pelka