DEV Community

Michael65589
Michael65589

Posted on

How to connect Python with Angular

Hello,
maybe it is simple but I didn't find a satisfied answer yet.
I have a python application that collects data over CAN bus (temperature, weight, ...) and I want to visualize them over Angular.
On the one side I wrote the Python application that cyclic read the CAN-bus data and write them to the console and on the other hand I wrote a small Angular application that contains in the first step a simple table.
Now I want to fill in the table every 10 seconds with data from the Python application instead of printing them to the console..
How can I connect this both?
My first thought were a simple file where I save the values from Python and read them with Angular.
Second solution a database, but I think this is to much for only a few values
So is there a direct way to access to the Python data from Angular?

Top comments (2)

Collapse
 
ernom profile image
ernom

I use angular frontend and python backend all the time in form of FastAPI. You could take a look at websocket solution so you dont have to spam your backend for new result but you can push to frontend when values change.

Good luck!

Collapse
 
michael65589 profile image
Michael65589

Thanks ernom,
I tried a bit with Python, Flask and Angular, but I will evaluate FastAPI.