Backends and frontends communicate with each other using REST APIs. So, in your backend, you should create a REST API, which when hit would give query your database and send over data in form of a JSON. Your front end should make an ajax call to your REST API and process the returned JSON.
Read moreWhich database is best for Python?
PostgreSQL database PostgreSQL is the recommended relational database for working with Python web applications.
Read more