0

I am trying to get data from database with python(pure python).

I am using axios to get the data from python to my react application so that I can show it to the frontend. The problem is fetching data with axios only shows me the python file contents as result instead of what python has fetched from the database. I don't know if it is because I am using axios or if I am missing something. Can someone help?

23rd Apr 2020, 4:57 PM
prime omondi
prime omondi - avatar
2 ответов
0
Show us your code, it will be easier to help you. I don't know python but you probably return data in wrong way.
23rd Apr 2020, 7:25 PM
Michal
Michal - avatar
0
I have tested the python file to see its response independent of the react app and it returns the right response.My main concern was whether we can use axios to get data from the database through python. My axios code in react is this export function fetchPosts(){ return dispatch =>{ axios.get('./python/getPosts.py) .then(resp=>{ dispatch(fetchPostsSucceeded(resp.data)); console.log(resp); }); } } When I log to the console the resp data is just showing me all the code that I have written in python.So really the real concern is to get what python returns from the database and not print out word for word what I have written in the python file
24th Apr 2020, 12:07 AM
prime omondi
prime omondi - avatar