Re: syncdb always indicates there are no fixtures
Tx a lot "Restless"... As yr post took me a while to decipher it and get most of the info, I thought it might be usefull to post extra info based on yr post. Django allows for extension to the command line (./manage.py). One of the extension is provided by Google : http://code.google.com/p/django-command-extensions/ Installation is clearly explained : setup.py build setup.py install the add the extension to your installed apps. \T, On Jun 11, 10:21 pm, eXt wrote: > On 11 Cze, 12:19, tsmets 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 > clonehttp://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.
Re: syncdb always indicates there are no fixtures
On 11 Cze, 12:19, tsmets 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.
Re: syncdb always indicates there are no fixtures
On Fri, Jun 11, 2010 at 6:19 AM, tsmets wrote: ... > > 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 ? > ... One possibility is to write yourself one or more management commands which you could invoke by hand, or from a shell script, depending on how automatic you mean by automatic. -- 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.
Re: syncdb always indicates there are no fixtures
I have a XML fixture with the language codes if you need it: http://pastebin.com/U4cAxXzY On Fri, Jun 11, 2010 at 12:19, tsmets 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] > > > > > On Jun 11, 12:06 pm, Alexandre González wrote: > > ¿Are you setting the variable FIXTURES_DIR in settings.py? > > > > > > > > > > > > On Fri, Jun 11, 2010 at 12:03, Kenneth Gonsalves > wrote: > > > On Friday 11 June 2010 14:20:59 tsmets wrote: > > > > But I have json's files in multiple "fixtures" directories. > > > > [code] > > > > Thomas-SMETSs-MacBook-Pro:sportotop tsmets$ find . -type f -name > > > > "*.json" | grep -v "\.svn" > > > > ./Base/fixtures/Sports.json > > > > ./fixtures/Base-with-UserProfilesAndClubsNoAddresses.json > > > > ./fixtures/Users-Club-Roles-Addresses-CollectiveSports.json > > > > ./fixtures/Users-Club-Roles-Addresses-Sports.json > > > > ./fixtures/Users-Club-Roles-Addresses.json > > > > [/code] > > > > > > Why doesn't it pick them up ... ? > > > > > where are these files? they should be in a fixtures directory which is > at > > > the > > > same level as your models.py and views.py > > > -- > > > Regards > > > Kenneth Gonsalves > > > Senior Associate > > > NRC-FOSS at AU-KBC > > > > > -- > > > 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. > > > > -- > > Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, > .ppt > > and/or .pptxhttp://mirblu.com > > -- > 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. > > -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- 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.
Re: syncdb always indicates there are no fixtures
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] On Jun 11, 12:06 pm, Alexandre González wrote: > ¿Are you setting the variable FIXTURES_DIR in settings.py? > > > > > > On Fri, Jun 11, 2010 at 12:03, Kenneth Gonsalves wrote: > > On Friday 11 June 2010 14:20:59 tsmets wrote: > > > But I have json's files in multiple "fixtures" directories. > > > [code] > > > Thomas-SMETSs-MacBook-Pro:sportotop tsmets$ find . -type f -name > > > "*.json" | grep -v "\.svn" > > > ./Base/fixtures/Sports.json > > > ./fixtures/Base-with-UserProfilesAndClubsNoAddresses.json > > > ./fixtures/Users-Club-Roles-Addresses-CollectiveSports.json > > > ./fixtures/Users-Club-Roles-Addresses-Sports.json > > > ./fixtures/Users-Club-Roles-Addresses.json > > > [/code] > > > > Why doesn't it pick them up ... ? > > > where are these files? they should be in a fixtures directory which is at > > the > > same level as your models.py and views.py > > -- > > Regards > > Kenneth Gonsalves > > Senior Associate > > NRC-FOSS at AU-KBC > > > -- > > 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 > groups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. > > -- > Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt > and/or .pptxhttp://mirblu.com -- 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.
Re: syncdb always indicates there are no fixtures
¿Are you setting the variable FIXTURES_DIR in settings.py? On Fri, Jun 11, 2010 at 12:03, Kenneth Gonsalves wrote: > On Friday 11 June 2010 14:20:59 tsmets wrote: > > But I have json's files in multiple "fixtures" directories. > > [code] > > Thomas-SMETSs-MacBook-Pro:sportotop tsmets$ find . -type f -name > > "*.json" | grep -v "\.svn" > > ./Base/fixtures/Sports.json > > ./fixtures/Base-with-UserProfilesAndClubsNoAddresses.json > > ./fixtures/Users-Club-Roles-Addresses-CollectiveSports.json > > ./fixtures/Users-Club-Roles-Addresses-Sports.json > > ./fixtures/Users-Club-Roles-Addresses.json > > [/code] > > > > Why doesn't it pick them up ... ? > > > > where are these files? they should be in a fixtures directory which is at > the > same level as your models.py and views.py > -- > Regards > Kenneth Gonsalves > Senior Associate > NRC-FOSS at AU-KBC > > -- > 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. > > -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- 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.
Re: syncdb always indicates there are no fixtures
On Friday 11 June 2010 14:20:59 tsmets wrote: > But I have json's files in multiple "fixtures" directories. > [code] > Thomas-SMETSs-MacBook-Pro:sportotop tsmets$ find . -type f -name > "*.json" | grep -v "\.svn" > ./Base/fixtures/Sports.json > ./fixtures/Base-with-UserProfilesAndClubsNoAddresses.json > ./fixtures/Users-Club-Roles-Addresses-CollectiveSports.json > ./fixtures/Users-Club-Roles-Addresses-Sports.json > ./fixtures/Users-Club-Roles-Addresses.json > [/code] > > Why doesn't it pick them up ... ? > where are these files? they should be in a fixtures directory which is at the same level as your models.py and views.py -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- 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.
Re: syncdb always indicates there are no fixtures
Hello, Fixtures are described in the documentation, especially there: http://docs.djangoproject.com/en/dev/howto/initial-data/#automatically-loading-initial-data-fixtures You have to follow the name convention to get them automatically loaded. Regards, Xavier. -- 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.
syncdb always indicates there are no fixtures
When I run the syncdb : [code] Thomas-SMETSs-MacBook-Pro:sportotop tsmets$ ./manage.py syncdb Creating table auth_permission Creating table auth_group_permissions Creating table auth_group Creating table auth_user_user_permissions Creating table auth_user_groups Creating table auth_user Creating table auth_message Creating table django_content_type Creating table django_session Creating table django_site Creating table django_admin_log Creating table Base_country Creating table Base_language Creating table Base_address ... You just installed Django's auth system, which means you don't have any superusers defined. Would you like to create one now? (yes/no): yes Username (Leave blank to use 'tsmets'): tsmets E-mail address: tsm...@gm ... .com Password: Password (again): Superuser created successfully. Installing index for auth.Permission model Installing index for auth.Group_permissions model Installing index for auth.User_user_permissions model Installing index for auth.User_groups model Installing index for auth.Message model Installing index for admin.LogEntry model Installing index for Base.Addres... No fixtures found. [/code] But I have json's files in multiple "fixtures" directories. [code] Thomas-SMETSs-MacBook-Pro:sportotop tsmets$ find . -type f -name "*.json" | grep -v "\.svn" ./Base/fixtures/Sports.json ./fixtures/Base-with-UserProfilesAndClubsNoAddresses.json ./fixtures/Users-Club-Roles-Addresses-CollectiveSports.json ./fixtures/Users-Club-Roles-Addresses-Sports.json ./fixtures/Users-Club-Roles-Addresses.json [/code] Why doesn't it pick them up ... ? Now I have another issue ... I tend to introduce my data through a django-shell. This is IMHO a very efficient way as I can easily alter the model. I use json files for very static informations : Countries, Languages + some reference data that I use to parametrize the behavior of the application but not for most of my data. How could I run these "console" scripts as fixture in a convenient way ? \T, -- 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.