there is an error when I run "python manage.py loaddata fixtures / initial_data.json"
guor911 opened this issue · 6 comments
Error message: no fixture found.
I also did not find the data file to be imported in the project directory.
Finally,
- many of the files in the project are also python2 syntax.(eg. xrange -> rang; print -> print(); reload -> importlib.reload);
- import error path:
Log:
C:\Python\Python36\python.exe E:/PycharmProjects/JMeter-Control-Center/run.py
.
.
.
.
.
.
DEBUG:matplotlib: CACHEDIR=C:\Users\Jason.matplotlib (2019-01-14 00:51:40; init.py:415)
DEBUG:matplotlib.font_manager: Using fontManager instance from C:\Users\Jason.matplotlib\fontlist-v300.json (2019-01-14 00:51:40; font_manager.py:1362)
DEBUG:matplotlib.pyplot: Loaded backend TkAgg version unknown. (2019-01-14 00:51:40; pyplot.py:211)
CommandError: No fixture named 'fixtures' found.
Process finished with exit code 0
This error is happened after ./manage.py loaddata fixtures/initial_data.json ? Because fixtures is just
a folder. The test data file is called data_example.csv in root directory.
just change the data file path and file name, like below:
./ manage. py loaddata data_example.csv
I will try again.
And another thing, I sent you a email( your gmail address) and look forword to your reply.
No it should be ./manage.py loaddata fixtures/initial_data.json
Dev file is just an example to try to upload data via gui
ok, i see. thx.
there was an error when I upload the csv file via gui
I'm not sure why the user is not present in "user" table.
log:
django.db.utils.IntegrityError: insert or update on table "test" violates foreign key constraint "test_started_by_id_3df308f9_fk_user_id"
DETAIL: Key (started_by_id)=(0) is not present in table "user".
This fake user should appear from those fixtures: {"model": "administrator.user", "pk": 0, "fields": {"login": "default"}}
you can try to insert it with
insert into jltc.user values (0, 'default');
In other side this I would fix in code