I am trying to create a npm run script that can start react app and then activate python virtual env to run flask server.
scripts in package.json:
{
"scripts": {
"start": "react-scripts start",
"both": "concurrently \"react-scripts start\" \"cd ../backend && "env/scripts/activate\" && py src/app.py\"",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
}
above I am using concurrently
. But executing the both
script run react and give following error:
[1] 'env' is not recognized as an internal or external command,
[1] operable program or batch file.
[1] cd ../backend && env/scripts/activate && py src/app.py exited with code 1
[0] i 「wds」: Project is running at http://192.168.137.1/
[0] i 「wds」: webpack output is served from
[0] i 「wds」: Content not from webpack is served from D:\Work\movielust\frontend\public
[0] i 「wds」: 404s will fallback to /
[0] Starting the development server...
My dir structure is:
main
|___frontend
| |___package.json
|___backend
| |___env
| |___src
| |___app.py
is there any workaround for this or this not really possible or is threre any other way to achieve running both react and flask in one go?
"scripts":
"flask-dev": "pip install -r requirements.txt && python -m flask --app api/index run -p 5328 --reload",
"next-dev": "next dev",
"dev": "concurrently \"pnpm run next-dev\" \"pnpm run flask-dev\"",
then run npm run dev which will pick up the environment and packages from it...