Before you begin, ensure you have the following installed on your system:
- Python: Version 3.8+
- pip: Package installer for Python
- Node.js: Version 14+
- npm: Node package manager
- SQLite: (No need for separate installation; it will be managed automatically during local development)
Open your terminal and run the following commands to clone the repository and navigate to the project directory:
git clone https://github.com/SushiOnToast/FoodLink.git
cd FoodLink
Change to the backend directory:
cd backend
Set up a virtual environment to manage dependencies:
python -m venv venv
If your execution policy allows, run:
.\venv\Scripts\Activate.ps1
If you encounter an error regarding the execution policy, you may need to change it temporarily with the following command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
After that, try activating again.
Alternatively, you can activate the environment using:
venv\Scripts\activate
venv\Scripts\activate
source venv/bin/activate
Install the required packages using pip:
pip install -r requirements.txt
Create a .env
file in the backend
directory and set the following environment variables:
DJANGO_SECRET_KEY=your_secret_key
DJANGO_DEBUG=True
Note: Replace your_secret_key
with a strong secret key. You can generate one using Django's django-admin
command or an online key generator:
django-admin shell -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
Run the database migrations to set up the database schema:
python manage.py migrate
Creating a superuser provides access to the Django admin panel, allowing you to manage database models easily:
python manage.py createsuperuser
Start the Django development server:
python manage.py runserver
Your Django backend will be running at http://localhost:8000
.
Change to the directory where the frontend is located:
cd ../frontend
Install the required dependencies for the frontend:
npm install
Create a .env
file in the frontend
directory with the following content:
VITE_API_URL=http://127.0.0.1:8000/
VITE_IMG_BASE_URL=http://127.0.0.1:8000
VITE_MAPBOX_ACCESS_TOKEN=your_mapbox_access_token
Note: Replace your_mapbox_access_token
with a Mapbox access token. You will need to create a Mapbox account and utilize the free tier to obtain this token.
Start the React development server:
npm run dev
Your React frontend will be running at http://localhost:5173
.
- Open your browser and navigate to
http://localhost:5173
to access the React frontend. - The frontend communicates with the Django backend to handle user authentication, profile management, and other features.
If you encounter any issues during setup or running the project, consider the following:
- Ensure all dependencies are correctly installed.
- Double-check your environment variable configurations in the
.env
files. - Review the terminal output for any error messages that may provide clues on resolving issues.