Skip to main content

Overview

Aqua-IoT is a Django-based web application for monitoring aquaponics systems. This guide will walk you through installing the application on your development or production environment.

Prerequisites

Before installing Aqua-IoT, ensure you have the following installed on your system:
  • Git - Version control system (Download & Install Git)
  • Python 3.7+ - Programming language runtime (Download & Install Python)
  • pip - Python package manager (included with Python)
  • PostgreSQL - Database server (recommended for production)
  • MQTT Broker - For IoT device communication (e.g., Mosquitto, HiveMQ)
The application requires Python 3.7 or higher. Ensure your Python version is compatible before proceeding.

Installation Steps

1

Clone the Repository

Clone the Aqua-IoT repository from GitHub to your local machine:
git clone https://github.com/barrancocarlos/Aqua-IoT.git
cd Aqua-IoT
2

Navigate to Django Directory

The Django application is located in the Django subdirectory:
cd Django
3

Set Up Virtual Environment

Install pipenv and create an isolated Python environment:
# Install pipenv globally
pip install pipenv

# Activate virtual environment
pipenv shell

# Install all dependencies
pipenv install
4

Install Dependencies

The application requires the following Python packages (defined in Pipfile):
  • Django - Web framework
  • Django REST Framework - API toolkit
  • psycopg2 - PostgreSQL database adapter
If using pipenv (recommended):
pipenv install
5

Configure Database

Set up your PostgreSQL database. See the Configuration page for detailed database settings.
# Create PostgreSQL database
createdb aqua
6

Run Database Migrations

Apply database migrations to set up the schema:
python manage.py migrate
7

Create Superuser (Optional)

Create an admin user to access the Django admin panel:
python manage.py createsuperuser
Follow the prompts to set username, email, and password.
8

Collect Static Files

Gather all static files into the STATIC_ROOT directory:
python manage.py collectstatic
9

Run Development Server

Start the Django development server:
python manage.py runserver
The application will be available at http://localhost:8000

Verify Installation

After completing the installation:
  1. Access the Web Interface: Open your browser and navigate to http://localhost:8000
  2. Check Admin Panel: Visit http://localhost:8000/admin and log in with your superuser credentials
  3. Test API Endpoints: Verify that the REST API is accessible

MQTT Broker Setup

For IoT device communication, you need to set up an MQTT broker:
# Install Mosquitto
sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients

# Start Mosquitto service
sudo systemctl start mosquitto
sudo systemctl enable mosquitto

Arduino Setup

To connect Arduino sensors to the system:
  1. Install the Arduino IDE
  2. Install required libraries:
    • DHT sensor library
    • OneWire
    • DallasTemperature
    • GravityTDS
  3. Upload the sensor code from the Arduino/ directory to your Arduino board
  4. Configure the MQTT broker connection in the Arduino code

Troubleshooting

Common Issues

The PostgreSQL adapter is not installed. Run:
pipenv install psycopg2
On some systems, you may need to install psycopg2-binary instead:
pip install psycopg2-binary
Ensure PostgreSQL is running and the database exists:
# Check PostgreSQL status
sudo systemctl status postgresql

# Create database if it doesn't exist
createdb aqua
Specify a different port when running the server:
python manage.py runserver 8080
Run collectstatic again and ensure STATIC_ROOT is properly configured:
python manage.py collectstatic --clear

Next Steps

Configuration

Configure database, security, and application settings

Production Setup

Deploy Aqua-IoT to a production environment

Build docs developers (and LLMs) love