# AgroSmart Malawi – Stage 2: SMS Advisory Bot Backend
AI-powered crop advisory platform for Malawian farmers.
Built with Python/Django + Africa's Talking SMS Gateway.
---
## 🗂 Project Structure
```
agrosmart/
├── agrosmart/ # Django project config
│ ├── settings.py # All configuration
│ ├── urls.py # Root URL routing
│ └── celery.py # Async task queue
├── sms_bot/ # Core SMS bot engine
│ ├── parser.py # Intent detection + response engine
│ ├── gateway.py # Africa's Talking integration
│ ├── models.py # FarmerProfile, SMSSession, SMSLog
│ ├── views.py # Webhook + admin API endpoints
│ └── tests/ # Unit tests
├── crops/ # Knowledge base
│ ├── models.py # Crop, Disease, AgronomyTip
│ └── management/commands/seed_crops.py
├── weather/ # Weather advisory (Stage 4)
├── market/ # Market prices (Stage 4)
├── accounts/ # Auth
├── requirements.txt
└── .env.example
```
---
## 🚀 Quick Start
### 1. Clone and set up Python environment
```bash
git clone
github.com
cd agrosmart-malawi
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
pip install -r requirements.txt
```
### 2. Configure environment
```bash
cp .env.example .env
# Edit .env with your database credentials and API keys
```
### 3. Set up PostgreSQL database
```sql
CREATE DATABASE agrosmart_db;
CREATE USER agrosmart_user WITH PASSWORD 'securepassword';
GRANT ALL PRIVILEGES ON DATABASE agrosmart_db TO agrosmart_user;
```
### 4. Run migrations
```bash
python manage.py makemigrations
python manage.py migrate
```
### 5. Seed the crop knowledge base
```bash
python manage.py seed_crops
```
Output:
```
Created crop: 🌽 Maize
✓ Created disease: Maize Streak Virus
✓ Created disease: Northern Leaf Blight
✓ Created disease: Fall Armyworm
Created crop: 🍅 Tomato
✓ Created disease …