- Clone the repository.
- Create a virtual environment using venv:
python -m venv venv
- Activate the virtual environment:
./venv/Scripts/activate
After activating the virtual enviornment, navigate to backend:
cd backend
(Note: For macOS/Linux, use source venv/bin/activate)
- Install the dependencies:
pip install -r requirements.txt
- Make sure Docker Desktop and Docker Compose are installed & Docker Engine is running.
- From the project root, run:
docker-compose up -d
- This will pull and start the following containers:
- PostgreSQL (port 5432)
- Adminer (port 8080)
- To access PostgreSQL GUI: Access http://localhost:8080
- Check configuration details in
docker-compose.yml
- To stop the containers:
docker-compose down
- Ensure the PostgreSQL container is running:
docker-compose up -d
- Create migration files (if not already committed):
python manage.py makemigrations
- Apply migrations to the database:
python manage.py migrate
To process background tasks, you need to run Celery in a separate terminal.
- Open a new terminal window.
- Navigate to your project root and activate the virtual environment:
./venv/Scripts/activate
- Start the Celery worker (replace
<project_name>with the name of the folder (FarmAssist-Backend) containing yourcelery.pyandsettings.pyfiles):
celery -A <project_name> worker -l info --pool=solo
Windows Note: If you run into issues executing Celery on Windows, append the
--pool=soloflag:celery -A <project_name> worker --loglevel=info --pool=solo
Back in your original terminal (with the virtual environment activated), start the Django development server:
python manage.py runserver