This project simulates a Raspberry Pi temperature sensor using Django for the backend and TimescaleDB for time-series data storage. The project is containerized using Docker Compose for easy setup and deployment.
- Django: Backend framework for the web application.
- Django Ninja: Fast and modern web framework for building APIs with Django.
- TimescaleDB: Time-series database built on PostgreSQL for storing temperature data.
- Celery: Distributed task queue for handling periodic sensor data generation.
- Docker Compose: Container orchestration for managing the application's services.
- Django
- TimescaleDB
- Docker
- Docker Compose
Ensure you have the following installed on your system:
-
Clone the Repository
git clone https://github.com/yourusername/raspberry-pi-temp-sensor-simulation.git cd raspberry-pi-temp-sensor-simulation
-
Create Environment Variables File Create a
.env
file in the project root and add the following environment variables:DJANGO_SECRET_KEY=your_secret_key POSTGRES_DB=your_db_name POSTGRES_USER=your_db_user POSTGRES_PASSWORD=your_db_password
-
Build and Run Docker Containers
docker-compose up --build
-
Apply Migrations and Create Superuser
docker-compose exec web python manage.py migrate docker-compose exec web python manage.py createsuperuser
- Access the Django admin at
http://localhost:8000/admin
and log in with the superuser credentials. - The REST API is accessible at
http://localhost:8000/api/
.