언어 설정

Menu
Sites
Language
How to connect DB and web app with python?

I had not developed any web with python.

I know it is possible to connect php but I don't know how to use php on tizen studio.

I want to connect DB using by python or php.

Could you let me know any document or codes?

Thank you.

Responses

1 댓글
Iqbal Hossain

hi 명훈 심, It is not a good idea to consume/connect a database server directly from your mobile/gear application. You can use a server as middleware to connect to a db securely. See the conceptual diagram, 

 

Here is an example python rest server code, 

https://www.codementor.io/sagaragarwal94/building-a-basic-restful-api-in-python-58k02xsiq

You can get data from db using python and expose as json. From mobile/gear application you can consume that code using rest/http request. 

Your python server provide data like above. 

From your tizen app, use XmlHttpRequest or Ajax to consume the json data. example code here, 

https://developer.tizen.org/community/code-snippet/web-code-snippet/how-use-post-method-xmlhttprequest

hope this will solve your problem.