Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/OluwagbeminiyiA/agro_pulse-API/llms.txt

Use this file to discover all available pages before exploring further.

AgroPulse uses python-decouple to read configuration values. When you start the server, python-decouple looks for a .env file in the project root and falls back to system environment variables if no file is present. You must supply all required variables before running migrations or starting the server.

Django settings

VariableDescriptionRequired
DJANGO_SECRET_KEYDjango cryptographic secret key used for signing sessions and tokensYes
DEBUGSet to True for local development, False in productionNo (default: False)
ALLOWED_HOSTSComma-separated list of hostnames the server may serve (e.g. localhost,127.0.0.1)Yes
CORS_ALLOWED_ORIGINSComma-separated list of origins allowed to make cross-site requestsYes

Database

AgroPulse uses PostgreSQL exclusively. SQLite is not supported.
VariableDescriptionDefault
DB_NAMEPostgreSQL database name
DB_USERPostgreSQL user
DB_PASSWORDPostgreSQL password
DB_HOSTPostgreSQL hostlocalhost
DB_PORTPostgreSQL port5432

Email

AgroPulse sends OTP verification emails via SMTP. The settings below configure the Gmail SMTP backend used by default.
VariableDescription
EMAIL_SENDERThe Gmail address used as From in outgoing mail and as the OTP sender
EMAIL_PASSWORDThe Gmail app password for the sender account
EMAIL_HOST is hardcoded to smtp.gmail.com, EMAIL_PORT to 587, and EMAIL_USE_TLS to True in settings.py. You do not need to set these in your .env file.

OTP settings

VariableDescription
OTP_EMAIL_THROTTLE_FACTORControls OTP throttling (seconds between requests)
OTP_EMAIL_COOLDOWN_DURATIONCooldown period after multiple OTP failures
OTP_EMAIL_TOKEN_VALIDITYHow long (in seconds) an OTP token remains valid

Squad payment gateway

AgroPulse processes payments through the Squad payment gateway. All five variables are required for payment initiation, verification, escrow, and payout to work.
VariableDescription
SQUAD_SECRET_KEYYour Squad API secret key
SQUAD_PUBLIC_KEYYour Squad API public key
SQUAD_MERCHANT_IDYour Squad merchant ID
SQUAD_BASE_URLSquad API base URL. Sandbox: https://sandbox-api-d.squadco.com
SQUAD_PAYMENT_URLSquad payment initiation endpoint URL

Sample .env file

# Django
DJANGO_SECRET_KEY=your-django-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000

# Database
DB_NAME=agropulse
DB_USER=agropulse_user
DB_PASSWORD=your-db-password
DB_HOST=localhost

# Email
EMAIL_SENDER=[email protected]
EMAIL_PASSWORD=your-gmail-app-password

# OTP
OTP_EMAIL_THROTTLE_FACTOR=1
OTP_EMAIL_COOLDOWN_DURATION=300
OTP_EMAIL_TOKEN_VALIDITY=300

# Squad payment gateway
SQUAD_SECRET_KEY=sk_test_your_squad_secret_key
SQUAD_PUBLIC_KEY=pk_test_your_squad_public_key
SQUAD_MERCHANT_ID=your_merchant_id
SQUAD_BASE_URL=https://sandbox-api-d.squadco.com
SQUAD_PAYMENT_URL=https://sandbox-api-d.squadco.com/transaction/initiate
Never commit your .env file to version control. Add .env to your .gitignore before making your first commit.

Celery and Redis

If you use Celery for asynchronous task processing, add the following variable. Celery and Redis are included as dependencies in pyproject.toml.
VariableDescriptionExample
CELERY_BROKER_URLConnection URL for the Celery message brokerredis://localhost:6379/0

Build docs developers (and LLMs) love