Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3212582
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:51:11+00:00 2026-05-17T14:51:11+00:00

I have successfully created my first django project. I have two apps in my

  • 0

I have successfully created my first django project.

I have two apps in my project foo and foobar.

I have created a folder named ‘fixtures’ in each of the app folders. I have NOT specified a fixtures directory in my settings.yml, so (according to the docs), django should be looking in my {app}/fixtures folder.

In the {app}/fixtures folder, I have several YML files. I have split the initial data for the various modules into separate YML files, making sure there are no cross file dependencies (i.e. all related models are in the same YML file and ancestors occur in the file before models that use them).

However, when I run./manage.py syncdb after the db objects were successfully created, there was the following message:

No fixtures found

I then tried to manually load the fixtures by using the loaddata command:

./manage.py loaddata 0100_foobar.yml
Problem installing fixture '0100_foobar': yml is not a known serialization 

Is the documentation given in the link above wrong?, or do I need to install a module in order for django to grok YML?

BTW, the YML files parse correctly and have been checked for correctness (i used them successfully in another project) – so that is not the problem

[Edit]

I have installed PyYaml and renamed my fixtures files as per Manoj’s instructions. I am able to get a little further down the line, but I am still encountering problems (BTW, I am using PyYaml 3.0.9).

Here is the Model in my project ORM (i.e. {app}/model.py):

class Currency(models.Model):
    short_name = models.CharField(max_length=3, db_index=True, unique=True, null=False) # ISO Code
    long_name = models.CharField(max_length=64, db_index=True, unique=True, null=False)
    spot_settle = models.IntegerField(null=False, default=0)
    rounding = models.IntegerField(null=False, default=2)

Here is the YAML file I am importing:

Currency:    
  currency_aud : { short_name: AUD , long_name: Australia - Dollars , spot_settle: 0, rounding: 2 }    
  currency_cad : { short_name: CAD , long_name: Canada - Dollars , spot_settle: 0, rounding: 2 }    
  currency_eur : { short_name: EUR , long_name: Euro Member Countries - Euro , spot_settle: 0, rounding: 2 }    
  currency_gbp : { short_name: GBP , long_name: United Kingdom - Pounds , spot_settle: 0, rounding: 2 }    
  currency_jpy : { short_name: JPY , long_name: Japan - Yen , spot_settle: 0, rounding: 2 }    
  currency_usd : { short_name: USD , long_name: United States Of America - Dollars , spot_settle: 0, rounding: 2 }    
  currency_zar : { short_name: ZAR , long_name: South Africa - Rand, spot_settle: 0, rounding: 2 }    
  currency_hkd : { short_name: HKD , long_name: Hong Kong Dollar, spot_settle: 0, rounding: 2 }    
  currency_nzd : { short_name: NZD , long_name: New Zealand Dollar, spot_settle: 0, rounding: 2 }    
  currency_sgd : { short_name: SGD , long_name: Singapore Dollar, spot_settle: 0, rounding: 2 }    
  currency_dkk : { short_name: DKK , long_name: Danish Krone, spot_settle: 0, rounding: 2 }    
  currency_sek : { short_name: SEK , long_name: Swedish Krona, spot_settle: 0, rounding: 2 }    
  currency_chf : { short_name: CHF , long_name: Swiss Franc, spot_settle: 0, rounding: 2 }

Here is the stack trace when I run ./manage.py loaddata myapp/fixtures/currencies.yaml

me@somebox:~/work/demo/myproj$ ./manage.py loaddata reference/fixtures/0100_currency.yaml 
Installing yaml fixture 'reference/fixtures/0100_currency' from absolute path.
Problem installing fixture 'reference/fixtures/0100_currency.yaml': Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/loaddata.py", line 165, in handle
    for obj in objects:
  File "/usr/local/lib/python2.6/dist-packages/django/core/serializers/pyyaml.py", line 57, in Deserializer
    for obj in PythonDeserializer(yaml.load(stream), **options):
  File "/usr/local/lib/python2.6/dist-packages/django/core/serializers/python.py", line 84, in Deserializer
    Model = _get_model(d["model"])
TypeError: string indices must be integers, not str
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T14:51:11+00:00Added an answer on May 17, 2026 at 2:51 pm

    I tried to reproduce your problem in one of my projects. Apparently loaddata expects the extension of the file to match the serialization format. In your case you should rename your file to 0100_foobar.yaml (note the new extension).

    Local tests showed my hypothesis was correct.

    PS: YAML serialization requires the PyYAML library. If you already haven’t, install PyYAML.

    Update

    I copied the OP’s model to one of my projects. When I tried to load the sample YAML given by the OP as-is, I got the same error.

    After that I added some data using the admin app and used django.core.serializers.serialize to dump the data in YAML format.

    from django.core.serializers import serialize
    from app.models import Currency
    print serializers.serialize("yaml", Currency.objects.all())
    

    The result I got looked significantly different from what the OP posted. See below. I added three instances for the model and they are showing up.

    - fields: {long_name: Australia - Dollars, rounding: 2, short_name: AUD, spot_settle: 0}
      model: app.currency
      pk: 1
    - fields: {long_name: Canada - Dollars, rounding: 2, short_name: CAD, spot_settle: 0}
      model: app.currency
      pk: 2
    - fields: {long_name: Euro Member Countries - Euro, rounding: 2, short_name: EUR,
        spot_settle: 0}
      model: app.currency
      pk: 3
    

    I was able to load this data back without any trouble.

    Given the above, I suspect that there is something wrong with the OP’s YAML file. @skyeagle, can you try dumping the existing data and then try loading the dump back?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using WCF for the first time. I Have successfully created the service
I'm a relative newbie on iPhone app development but have successfully created a tab
I have a Rails app that I have successfully tested with Mongrel and Webkit.
I have recently just started working with Lucene (specifically, Lucene.Net) and have successfully created
I've been trying to teach myself to create and deploy Django apps. I've created
I am running cherokee to serve a django app using uwsgi. I have been
Hello and thank you for helping me with my project. So I have successfully
Noob Question here. I have created and successfully added an additional Page Layout to
I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008)
I believe that I have successfully impersonated my own user account while running an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.