使用单个 shell 脚本运行 react 和 flask [英] Running react and flask using a single shell script
问题描述
我已经构建了一个使用 ReactJS 作为前端和 Flask 作为中间件的应用程序.我可以使用以下命令序列来执行它.
I have built an application that uses a ReactJS as frontend and Flask as middleware. I'm able to execute it using the following sequence of commands.
npm start
cd Equation-Solver
python -m flask run
执行第一个命令后,我必须打开另一个终端窗口并执行接下来的 2 个命令.我想使用单个 shell 脚本一起执行它们.任何帮助将不胜感激.
After executing the first command, I have to open another terminal window and execute the next 2 commands. I would like to execute them together using a single shell script. Any help would be really appreciated.
推荐答案
创建一个 shell 脚本.在 npm start 行的末尾添加一个和号.这是该过程的背景.然后将运行其他命令.在这种情况下,react 应用程序将显示在终端上,但 python 应用程序也将运行.
Create a shell script. Add an ampersand at the end of the npm start line. This backgrounds that process. The other commands will then run. In this case the react app will show on the terminal, but the python app will be running also.
npm start &
cd Equation-Solver
python3 -m flask run
这篇关于使用单个 shell 脚本运行 react 和 flask的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!