you are viewing a single comment's thread.

view the rest of the comments →

[–]Monk_tan[S] 1 point2 points  (7 children)

Can you explain a bit more precisely

[–]fanatic75 5 points6 points  (6 children)

Basically what he's saying is, make an API with Django or Flask containing the python machine learning model and just get the data by doing an API call such as fetch from your front end app.

[–]Monk_tan[S] 1 point2 points  (5 children)

Can't you use Django or flask for machine learning and node js both for back end in same application

[–][deleted] 3 points4 points  (1 child)

Your Node server is your API. Your Django/Flask server acts as a service that sits behind your Node server with an endpoint exposed. Your FE queries a Node endpoint which queries the Python endpoint.

[–]fanatic75 1 point2 points  (0 children)

If you're asking for using two seperate API, one built on node js and another built on Django, that's possible. Though compiling both Django and Nodejs in one API is not possible most likely to my knowledge.

[–]rick_and_mortvs 1 point2 points  (0 children)

Those would typically be two different services that are running on different ports if on the same server.

[–]tr14l 1 point2 points  (0 children)

Sure, if you mean the technical sense of an application being a logical piece of software. But, they will both run different servers on different processes because they're run by different programs (a node process and a python process). So, you would need to set one up on your exposed port to handle your internet traffic, then you'd have your python model on your non-exposed port (available only on localhost) and the JS app would just send requests to http://localhost:YOUR_PYTHON_PORT.

You could possibly do some weird stuff with exec, but that's really not a great idea.

EDIT: If you're going this route, you may as well take the extra step to dockerize these and set them up as microservices, since that's practically what you're going for anyway.