hackoregon / team-budget

Repo for the Budget team's backend code
MIT License
6 stars 4 forks source link

Empty JSON responses when using local sqlite3 database #139

Open MikeTheCanuck opened 7 years ago

MikeTheCanuck commented 7 years ago

I followed the instructions in this project's README.md and was able to migrate, importcsv and launch the application, but when I load any of the endpoints, they all respond with an empty JSON document (e.g. http://192.168.99.100:8000/budget/history/)

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "count": 0,
    "next": null,
    "previous": null,
    "results": []
}

I have verified using DB Browser for SQLite that the expected data is in the database tables.

I have verified that after swapping the project_config.py for the one that points to AWS as the DB, I am seeing populated JSON responses [i.e. the code didn't change, just the datasource].

I can't imagine what is going wrong. Anyone have any ideas?

hassanshamim commented 7 years ago

My best guess is that youre importing the data to a different sqlite database than the one you run the application with. Are you doing this inside of a docker container?

A simple test would be to run manage.py shell and create a History object and save it. Then run the application and hit that same endpoint. If you see that object then the DB is definitely working with the application. So either the import isn't working or it is working just sending the data somewhere you don't want.

When you run the data import commands what folder are you in?