Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

there is an error when I run "python manage.py loaddata fixtures / initial_data.json" #17

Open
guor911 opened this issue Jan 13, 2019 · 6 comments

Comments

@guor911
Copy link

guor911 commented Jan 13, 2019

Error message: no fixture found.
I also did not find the data file to be imported in the project directory.

Finally,

  1. many of the files in the project are also python2 syntax.(eg. xrange -> rang; print -> print(); reload -> importlib.reload);
  2. import error path:
    image

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

@v0devil
Copy link
Member

v0devil commented Jan 14, 2019

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.

@guor911
Copy link
Author

guor911 commented Jan 14, 2019

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.

@v0devil
Copy link
Member

v0devil commented Jan 14, 2019

No it should be ./manage.py loaddata fixtures/initial_data.json
Dev file is just an example to try to upload data via gui

@guor911
Copy link
Author

guor911 commented Jan 14, 2019

ok, i see. thx.

@guor911
Copy link
Author

guor911 commented Jan 14, 2019

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".

image

image

image

image

@v0devil
Copy link
Member

v0devil commented Jan 14, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants