May I know if it can be done using Modules (constants.py) instead, and what 
would be the difference (performance / best practice etc) ?

Thanks Massimo. Learning along the way.

On Friday, August 10, 2012 9:57:59 PM UTC+8, Massimo Di Pierro wrote:
>
> When you do
>
>  python web2py.py -S yourapp -M -N -R yourscript.py
>
> -M will import your models and run yourscript.py as if it were a 
> controller.
> yourscript.py must read the data from where it is (a file?), loop over it, 
> and do db.table.insert(...)
> For example
>
> for name in ['a','b','c']:
>     db.person.insert(name=name)
> db.commit()
>
>
>
> On Thursday, 9 August 2012 22:47:51 UTC-5, mrtn wrote:
>>
>>
>> If they must be in the database, use a script to import them and run it 
>>> once 
>>> python web2py.py -S yourapp -M -N -R yourscript.py
>>
>>
>> Yes, the data must be in the db. By 'import them' in the script, do you 
>> mean import the database abstraction layer stuff by web2py, and use it to 
>> insert the data? Thanks!
>>
>

-- 



Reply via email to