You are right! But I mean that possible error's cause is the second assignment 'db=DAL(...) ' (after auth-settings and etc.)

Dave S <[email protected]> писал(а) в своём письме Mon, 16 Mar 2015 21:07:35 +0300:



On Monday, March 16, 2015 at 6:41:57 AM UTC-7, Val K wrote:
Hi!
As I see, you defined your table in the db.py, but 'db=DAL(...) ' is already exist in this file, I mean auth-settings and etc. If you want to use another database for your tables, I suppose, you must use another storage (not storage.sqlite) and another name for >>it ('my_db' instead 'db' for example)


There shouldn't be any problem with having multiple tables using the same "db=DAL(...)" statement.

In the app I'm working on here on this machine, I have db.py pretty much as shipped by Massimo and the crew (I add another validator to >it as the only change). My application-specific tables are defined in separate model files: localdb.py, for instance, just contains 1 line (aside from a lot of >comments out db.py)
db.define_table('localtable',Field('localtime', 'datetime'), Field('localwho', 'string'), Field('localstatus', '>string'))

Note that model files are read in alphabetical order, so for me db.py gets run first then localdb.py. And the DAL() call is only run from the >db.py.

For a small app, putting the define_table into db.py should be okay, just put it at the bottom of the file. My app gets new (additional) >tables every once and a while, as I find a new use for the server, and its convenient to put those new tables in their own file. The only >gotcha I'm aware of is the order-of-run, so I don't have a "bob.py", I have a "localbob.py".

/dps



--Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Pc5NmA9Vytc/unsubscribe. To unsubscribe from this group and all its topics, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.



--
Написано с помощью почтового клиента Opera: http://www.opera.com/mail/

---
Это сообщение свободно от вирусов и вредоносного ПО благодаря защите от вирусов 
avast!
http://www.avast.com

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to