Re: How to populate the database

2009-12-10 Thread Zeynel
I tried to convert my csv file with csv2json.py and it worked before (see this thread http://groups.google.com/group/django-users/browse_frm/thread/a00b529ba2147d91/efb82ba2893cc0a7?lnk=gst&q=csv#efb82ba2893cc0a7) but now I am trying the same exact thing in a different directory and I get this erro

Re: How to populate the database

2009-12-10 Thread Zeynel
Thanks, I'll try it now. What does os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' do? I read the documentation here http://docs.python.org/library/os.html but I didn't understand. My app is in C:.../Documents/PROJECTS/Django/sw2/wkw2. Do I enter? os.environ['DJANGO_SETTINGS_MODUL

Re: How to populate the database

2009-12-10 Thread John M
You could also use OpenOffice with the SQLIte connector (I think) I use Access in Windows, works great! But you might try getting the CSV into a JSON format that the manage.py loaddata command could use, that set's you up for the future too. J On Dec 10, 8:57 am, Zeynel wrote: > Can anyone poi

Re: How to populate the database

2009-12-10 Thread Shawn Milochik
Sure, here's a quick & dirty sample I put up on pastebin: http://pastebin.com/f651cf8de -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send ema

Re: How to populate the database

2009-12-10 Thread Zeynel
Thanks. I couldn't make the sqlite3 shell work on windows command prompt, so I cannot use .import. > read the csv with csv.DictReader, then create instances of my model > with the values from the resulting dictionary, then calling a .save() on > the new instance. Do you have more detailed instruc

Re: How to populate the database

2009-12-10 Thread Shawn Milochik
There are different ways to do it, depending on how much data you have and how often you plan to do it. The fastest way for large files is to use sqlite3's .import command to directly import a file. However, this will bypass any validation done by your models. The way I do it is to read the csv