How i can connect my ReactJS App with python backend to MySQL database?

71 Views Asked by At

What i need to connect my python server file to react app? I managed to connect a python file to an SQL database and i can write MySQL quires in python, but I have no idea how to link a python file to react app

this is my index.py:

from getpass import getpass
from mysql.connector import connect, Error
try:
    with connect(
        host="localhost",
        user="root",
        password= getpass(),
        database = "knowledges"
    ) as connection:
            show_articles = "SELECT * FROM articles"
        with connection.cursor() as cursor:
            cursor.execute(show_articles)
            for artcl in cursor:
                print(artcl)
            
except Error as e:
    print(e)

can i connect they without python frameworks or i can use pure python language?

0

There are 0 best solutions below