Skip to content

itinstructor/AquaponicsWeb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aquaponics Web Application

Setup Instructions for Windows Server 2025 and Waitress

  1. Install IIS HTTPHandler (IIS uses this to start the waitress application)
  2. Install the latest version of Python
  3. Create a folder under c:\intepub

Creating and Using a Virtual Environment

  1. Create a virtual environment:

  2. Windows Command Prompt/PowerShell in the base directory

    python -m venv .venv
  3. Activate the virtual environment:

    .venv\Scripts\activate
  4. Install required packages:

    pip install flask waitress requests flask-sqlalchemy
  5. Restart the IIS server

    iisreset

Setup Waitress with Windows Server IIS

  1. Setup folder under inetpub for flask application
  2. Configure IIS to use the virtual environment Python interpreter with web.config

Sensors Purchased

Temperature Sensor

Gravity: Analog Industrial pH Sensor / Meter Pro Kit V2

Non-Contact Water Level Sensor

Aquaponics Research

System Components

  • Oxygenation
    • More bubblers with fish
    • Bubblers with plants
  • Sump for circulation of water, pH sensors, health of water without disturbing the fishies
  • Quiet oscillating fan for plants

Electrical Conductivity Sensor Options Research


Code Summary

  • main_app.py: The main Flask web application. It provides a web interface for viewing MJPEG video streams from remote cameras, handles configuration, logging, and routes for the web UI. It uses MediaRelay and CachedMediaRelay to efficiently distribute video streams to multiple clients.

  • frame_cache.py: Contains the FrameCache system, which buffers video frames from unreliable wireless cameras. It stores frames temporarily and serves them with a delay to smooth out connection issues, providing stable video playback.

  • cached_relay.py: Defines the CachedMediaRelay class, which combines the relay and frame caching systems. It provides stable video streaming from unreliable sources by buffering frames and distributing them to clients at a steady rate.

  • waitress_app.py: Sets up and runs a Waitress WSGI server to serve the Flask web application. It configures logging and ensures the app can be deployed in a production environment.

  • database.py: Database configuration module that initializes SQLAlchemy for storing visitor location data.

  • geomap_module/: A Flask blueprint module for tracking and displaying visitor locations on an interactive map.

    • models.py: Defines the VisitorLocation database model for storing IP geolocation data
    • routes.py: Provides endpoints for the visitor map page and API endpoints for location data
    • helpers.py: Utility functions for extracting visitor IPs and fetching geolocation data from ipinfo.io
    • templates/visitors.html: Interactive map visualization using Leaflet.js with marker clustering

Features

Visitor Tracking Map

The application now includes an automatic visitor tracking system that displays where visitors are connecting from on an interactive world map:

  • Automatic Tracking: Every visitor's location is automatically logged based on their IP address (respects 1-hour cooldown per IP)
  • Interactive Map: Uses Leaflet.js with marker clustering for clean visualization
  • Statistics: Shows total visits and unique visitor counts
  • Recent Visitors: Displays a table of recent connections with timestamps
  • Privacy Friendly: Only stores city/region/country level data, not exact addresses
  • Free Tier: Uses ipinfo.io API (50,000 requests/month free tier)

Access the visitor map at: /aquaponics/visitors

License

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Copyright (c) 2025 William A Loring

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published