This is a full-stack web application using React for the frontend and Flask for the backend.
Before you start, ensure you have the following installed on your system:
project-directory/
├── backend/
│ ├── app.py
│ ├── requirements.txt
│ └── venv/
└── frontend/
├── package.json
├── src/
└── node_modules/
-
Navigate to the
backenddirectory:cd backend -
Create and activate a virtual environment:
- Windows:
python -m venv venv venv\Scripts�ctivate - Mac/Linux:
python3 -m venv venv source venv/bin/activate
- Windows:
-
Install the required Python packages:
pip install -r requirements.txt
-
Run the Flask server:
python app.py
The server will start at
http://127.0.0.1:5000.
-
Navigate to the
frontenddirectory:cd frontend -
Install Node.js dependencies:
npm install
-
Start the React development server:
npm start
The React app will be available at
http://localhost:3000.
To avoid CORS issues, the React app is configured to proxy requests to the Flask server. Ensure the proxy field in frontend/package.json is set correctly:
"proxy": "http://127.0.0.1:5000"-
Backend Dependencies: If additional Python packages are required, add them to
requirements.txtusing:pip freeze > requirements.txt -
Frontend Build: For production deployment, create a production build of the React app:
npm run build
You can then serve the build files via Flask.
-
Module Not Found: Ensure all dependencies are installed:
- Backend:
pip install -r requirements.txt - Frontend:
npm install
- Backend:
-
CORS Issues: Ensure
flask-corsis installed and added toapp.py:from flask_cors import CORS CORS(app)
-
Virtual Environment Issues: Reactivate the virtual environment:
- Windows:
venv\Scripts�ctivate - Mac/Linux:
source venv/bin/activate
- Windows: