user784756
user784756

Reputation: 2373

Django and PostgreSQL "No Fixtures Found"

I've been trying to use PostrgeSQL with my Django apps but I get the following error before (right after starting the project when I only have the following files: __init__.py, manage.py, settings.pyc, urls.pyc, __init__.pyc, settings.py, urls.py) and after I've added models:

python manage.py syncdb
Creating tables ...
Installing custom SQL ...
Installing indexes ...
No fixtures found.

I'm not even trying to load fixtures. Psycopg2 is installed. This is the database section of my settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'myapp_development',                     
        # Or path to database file if using sqlite3.
        'USER': 'foo',                      # Not used with sqlite3.
        'PASSWORD': 'password',                  # Not used with sqlite3.
        'HOST': '',       
        # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                    
        # Set to empty string for default. Not used with sqlite3.
    }
}

Upvotes: 1

Views: 1706

Answers (3)

sergzach
sergzach

Reputation: 6764

This means that Django had not found any fixtures. This is a standard message if there are no fixtures.

Fixture is a file of the next format (using to create real objects in a database by an existing model):

[
  {
    "model": "myapp.person",
    "pk": 1,
    "fields": {
      "first_name": "John",
      "last_name": "Lennon"
    }
  },
  {
    "model": "myapp.person",
    "pk": 2,
    "fields": {
      "first_name": "Paul",
      "last_name": "McCartney"
    }
  }
]

See more for details: http://docs.djangoproject.com/en/dev/howto/initial-data/

Upvotes: 4

Sergey Lyapustin
Sergey Lyapustin

Reputation: 1936

When you run

manage.py syncdb

django try to load initial data for apps in you project. By default that data loaded from app-dir\fixtures\initial_data.[xml/yaml/json] files So when file does not exist you see:

No fixtures found

Lean more on django official page:

Upvotes: 1

Constantinius
Constantinius

Reputation: 35089

Did you set the FIXTURE_DIRS setting value in your settings.py?

See here for documentation.

Upvotes: 2

Related Questions