Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » syncdb always indicates there are no fixtures [RSS Feed]

#1 June 11, 2010 09:51:37

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

syncdb always indicates there are no fixtures


When I run the syncdb :

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
...
<snipped />

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...
<snipped />

No fixtures found.

But I have json's files in multiple "fixtures" directories.

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

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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 11, 2010 10:04:57

Xavier O.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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-fixturesYou 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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 11, 2010 11:02:32

Kenneth G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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.
>

> 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
>
>
> 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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 June 11, 2010 11:06:44

Alexandre G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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 <law...@au-kbc.org> wrote:

> On Friday 11 June 2010 14:20:59 tsmets wrote:
> > But I have json's files in multiple "fixtures" directories.
> >

> > 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
> >
> >
> > 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<django-users%2bunsubscr...@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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 June 11, 2010 11:19:07

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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 ?



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()




On Jun 11, 12:06 pm, Alexandre González <a...@mirblu.com> wrote:
> ¿Are you setting the variable FIXTURES_DIR in settings.py?
>
>
>
>
>
> On Fri, Jun 11, 2010 at 12:03, Kenneth Gonsalves <law...@au-kbc.org> wrote:
> > On Friday 11 June 2010 14:20:59 tsmets wrote:
> > > But I have json's files in multiple "fixtures" directories.
> > >

> > > 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
> > >
>
> > > 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<django-users%2bunsubscr...@google
> > 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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#6 June 11, 2010 11:32:32

Alexandre G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

syncdb always indicates there are no fixtures


I have a XML fixture with the language codes if you need it:http://pastebin.com/U4cAxXzYOn Fri, Jun 11, 2010 at 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 ?
>
>
>

> 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()
>
>
>
>
>
>
> On Jun 11, 12:06 pm, Alexandre González <a...@mirblu.com> wrote:
> > ¿Are you setting the variable FIXTURES_DIR in settings.py?
> >
> >
> >
> >
> >
> > On Fri, Jun 11, 2010 at 12:03, Kenneth Gonsalves <law...@au-kbc.org>
> wrote:
> > > On Friday 11 June 2010 14:20:59 tsmets wrote:
> > > > But I have json's files in multiple "fixtures" directories.
> > > >

> > > > 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
> > > >
> >
> > > > 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<django-users%2bunsubscr...@googlegroups.com>
> <django-users%2bunsubscr...@google 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<django-users%2bunsubscr...@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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#7 June 11, 2010 17:10:18

Bill F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

syncdb always indicates there are no fixtures


On Fri, Jun 11, 2010 at 6:19 AM, tsmets <tsm...@gmail.com> 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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#8 June 11, 2010 21:21:07

e.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

syncdb always indicates there are no fixtures


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 ?
>
>

> 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()
>
>
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#9 June 12, 2010 21:34:56

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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 <restless.be...@gmail.com> wrote:
> 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 ?
>
> >

> > 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()
>
> >
>
> 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 athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » syncdb always indicates there are no fixtures [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support