4

I wanted to start a testserver in Django so that I am able to test my API via Jasmine/FrisbyJs.

For that I found that python3 manage.py testserver would create a test-db and load all the testdata provided in the fixtures, which sound exactly what I need. I am NOT running Django-Testcases ATM.

I created a Fixture called testdata.json and stored it within ./fixtures. I also set up my ./projname/settings.py like that:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Fixture Dir
FIXTURE_DIRS = (
    os.path.join(BASE_DIR, 'fixtures'),
)

I also made sure python3 manage.py loaddata testdata works, which it does:

Installed 1 object(s) from 1 fixture(s)

However, running python3 manage.py testserver testdata.json or python3 manage.py testserver testdata leads to this error:

CommandError: Error: No database fixture specified. Please provide the path of at least one fixture in the command line.

What can I do about this?

Gundon
  • 2,081
  • 6
  • 28
  • 46

1 Answers1

1

python manage.py testserver [Fixture Name]

eg :

python manage.py testserver SampleData

SampleData.json file will be in app/fixture/

Pratik Bhatt
  • 871
  • 1
  • 8
  • 21