-
Navigate to the backend directory:
cd practice-app/backend
-
Create and Activate a Virtual Environment:
- For macOS/Linux:
python3 -m venv venv source venv/bin/activate
- For Windows:
python -m venv venv .\venv\Scripts\activate
(Ensure
(venv)
appears in your terminal prompt.) - For macOS/Linux:
-
Install Dependencies:
pip install -r requirements.txt
-
Apply Database Migrations:
python manage.py migrate
-
Create Test Data for Waste Categories:
python manage.py create_waste_test_data
-
(Optional) Create a Superuser:
python manage.py createsuperuser
(Follow the prompts.)
-
Modify Django Settings for Local Network Access:
- Open the file
practice-app/backend/config/settings.py
. - Find the
ALLOWED_HOSTS
setting. - Change it to:
// filepath: practice-app/backend/config/settings.py // ...existing code... ALLOWED_HOSTS = ['*'] // ...existing code...
- Open the file
-
Run the Django Development Server:
python manage.py runserver 0.0.0.0:8000
(The backend API should be accessible at
http://<your-local-ip-address>:8000/
andhttp://127.0.0.1:8000/
.)
-
Identify Your Computer's Local IP Address:
- macOS:
ifconfig | grep "inet " | grep -v 127.0.0.1
or System Settings > Network. - Windows:
ipconfig
in Command Prompt (look for IPv4 Address). - Linux:
ip addr show
orhostname -I
. (Let's assume your IP is192.168.1.100
for the next step; replace it with your actual IP.)
- macOS:
-
Update API Base URL in the Mobile App:
- Open the file
practice-app/MobileApp/constants/api.ts
. - Change
API_BASE_URL
to your computer's IP address:// filepath: practice-app/MobileApp/constants/api.ts // ...existing code... export const API_BASE_URL = 'http://<YOUR_COMPUTER_IP_ADDRESS>:8000'; // Example: export const API_BASE_URL = 'http://192.168.1.100:8000'; // ...existing code...
- Open the file
-
Navigate to the MobileApp directory: (Open a new terminal for this, or navigate from the project root)
cd practice-app/MobileApp
-
Install Mobile App Dependencies:
npm install
-
Run the Mobile App:
npx expo start
(Follow the instructions in the terminal to open the app on a device/emulator.)
-
Terminal 1 (Backend - from
bounswe2025group3/practice-app/backend
):source venv/bin/activate
(or.\venv\Scripts\activate
on Windows)python manage.py runserver 0.0.0.0:8000
-
Terminal 2 (Mobile App - from
bounswe2025group3/practice-app/MobileApp
):npm install
npx expo start