Django Testserver fixtures not used

I wanted to run testerver in Django so that I can test my API through Jasmine / FrisbyJs.

To do this, I found myself python3 manage.py testserver

creating a test-db and loading all the test data presented in the fixtures, which sounded exactly what I needed. I am NOT running ATM Django-Testcases.

I created a Fixture called testdata.json and saved it to ./fixtures

. I also created mine ./projname/settings.py

like this:

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 that it python3 manage.py loaddata testdata

works, what it does:

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

      

However, running python3 manage.py testserver testdata.json

or python3 manage.py testserver testdata

results in 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 it?

+3


source to share


1 answer


python manage.py testserver [Device Name]

eg:



python manage.py testserver SampleData

      

SampleData.json file will be in app / fixture /

+1


source







All Articles