On 11 Cze, 12:19, tsmets <tsm...@gmail.com> wrote:
> The problem was just the naming convention ...
> They should have been named initial_data.json as mentionned in the URL
> provided by Xavier.
>
> Any help on how to run python scripts directly to create my data
> sets .... ?
> What I do now is fine but could be better automated ?
>
> [code]
> from sportotop.Base.models import *
> countries = []
>
> countries.append(Country(iso_code='FR', name='France'))
> countries.append(Country(iso_code='DE', name='Germany'))
> countries.append(Country(iso_code='NL', name='Nederlands'))
> countries.append(Country(iso_code='UK', name='United Kingdom of Great
> Britain and Northern Ireland'))
> countries.append(Country(iso_code='PT', name='Portuges'))
> countries.append(Country(iso_code='CA', name='Canada'))
> countries.append(Country(iso_code='DK', name='Denmark'))
> countries.append(Country(iso_code='BE', name='Belgium'))
> countries.append(Country(iso_code='SE', name='Sweden'))
> countries.append(Country(iso_code='IT', name='Italy'))
> countries.append(Country(iso_code='SP', name='Spain'))
> countries.append(Country(iso_code='CR', name='Croatia'))
> countries.append(Country(iso_code='HU', name='Hungary'))
> for ctry in countries:
>   ctry.save()
>
> [/code]
You can use django-command-extensions, in particular runscript command
it provides. It allows you to run a script by calling ./manage.py
runscript your_script.py.
For a sample script look into scripts directory in LFC (hg clone
http://bitbucket.org/diefenbach/lfc-buildout-development/)

HTH

-- 
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 email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to