Ask coding questions

← Back to all posts
how to do a react flask app with python3 and nodejs in one repl?
h
Travelbug (0)

I'm wondering if I could use repl.it to develop a webapp that contains both, a python3 backend with flask and a nodejs frontent with react.

Basically I try to replicate this tutorial: https://blog.miguelgrinberg.com/post/how-to-create-a-react--flask-project

Is there a way to configure a repl to run python3 AND nodejs?

Commentshotnewtop
RYANTADIPARTHI (3324)

I'm not sure. I'm thinking no... But python3 and flask are the same language. Flask is python, but is only a webframework, so they are not separate. But front-end, shouldn't you use a styling language?

Travelbug (0)

@RYANTADIPARTHI Thanks for your reply. I want to create a frontend with react and a backend with flask. This means it would be most convenient to to run a react compiler on my repl. as well as a flask webserver.

One runs with nodejs and one with python. Ideally I want to have both on the same repl because both are in the same git repository as well. This would be no problem with a normal Linux environment where I just start two processes with nodejs and python.

RYANTADIPARTHI (3324)

@Travelbug yes, i think you can make that.

Travelbug (0)

@RYANTADIPARTHI but how do I get python3 AND nodejs running on a repl? I have no sudo apt-get to install anything. And I didn't manage to find any configuration settings for this.

Coder100 (12477)

why would you want to have node.js and flask running together? React is frontend, that is the one thing you must always remember. @Travelbug

RYANTADIPARTHI (3324)

@Travelbug yeah, node.js wouldn't be useful for the python.

Coder100 (12477)

React is for js frontend. It works well with node.js because of things like webpack and babel, but you can still have a flask backend.

https://www.youtube.com/watch?v=YW8VG_U-m48

Travelbug (0)

@Coder100 Thanks for the video, thats a great tutorial. I am aware of how it works. I just want my npm, yarn, react and all the stuff I use to develop the frontend in the same repl that I use to develop the backend, so that I can work on both at the same time.

This means I have to have node.js installed in the same repl as python3.

And I can find no way to do this.

Coder100 (12477)

@Travelbug it already is, try doing node

Travelbug (0)

@Coder100 Okay, this was a bit confusing. Did some digging and found out that:

  • If I create a node repl and add a python file (.py) to it, then it would install node and add python2.7 automatically. For my project I need python3 though.
  • If I create a python repl and add a javascript file (.js) to it, then it would install python3.8 and add node automatically.

So this seems to solve the problem for now. I just have to FIRST create a python repl and then add node, not the other way round. I really think there should be a way to manage installs and versions besides relying on automatic detection and import though.