Local Development Setup
This guide will help you set up the Rhea Agripad backend locally for development purposes.
Prerequisites
Before starting, ensure you have the following installed on your system:
- Python 3.8+
- Virtualenv
- EMQX MQTT Broker
- PostgreSQL (optional, SQLite can be used for development)
Django Backend Setup
1. Clone the Repository
git clone https://github.com/Rhea-Africa/agripad-multitenant-backend.git
cd agripad-multitenant-backend
2. Create a Virtual Environment
python3 -m virtualenv venv
3. Activate the Environment
For Linux/macOS:
source ./venv/bin/activate
For Windows:
.\venv\Scripts\activate
4. Create Environment Variables
Create a .env
file in the root directory:
touch .env
Add the following environment variables to the file:
DEBUG_MODE=True
SECRET_KEY='secret_key'
APP_ID='main'
API_KEY=''
DEVICES_LIST=device_001, device_002
DEVELOPMENT_DATABASE='main.sqlite3'
DATABASE_NAME='REDACTED'
DATABASE_USER='REDACTED'
DATABASE_PASSWORD='REDACTED'
DATABASE_HOST='localhost'
DATABASE_PORT=3306
ALLOWED_HOSTS_DEBUG='*'
ALLOWED_HOSTS_PROD='*'
EMAIL_BACKEND='backend'
EMAIL_HOST='mail_host'
EMAIL_HOST_PORT='465'
EMAIL_HOST_USER='mail_user'
EMAIL_HOST_PASSWORD='mail_password'
EMAIL_USE_TLS=True
EMAIL_USE_SSL=False
SENTRY_DSN=''
5. Install Dependencies
pip install -r requirements.txt
6. Run Migrations
python manage.py makemigrations && python manage.py migrate
7. Create Superuser
python manage.py createsuperuser
8. Run the Server
python manage.py runserver
Frontend Setup
For the frontend setup, follow the instructions in the Agripad Frontend Repository.