issues
search
kxs1119
/
Detection-System
An IoT project using motion sensors and geofencing to detect deer near highways, sending real-time GPS alerts to drivers. Built with Flask (Python) and Raspberry Pi, focusing on IoT, cloud integration, and sensor data processing.
1
stars
0
forks
source link
Connect Flask to PostgreSQL Database
#52
Open
kxs1119
opened
1 week ago
kxs1119
commented
1 week ago
Task Requirements
Set up PostgreSQL database on the server and ensure it’s accessible.
Install necessary dependencies in Flask (
psycopg2
,
SQLAlchemy
, etc.).
Configure Flask to connect to the PostgreSQL database.
Implement a basic API route to insert data into the database.
Implement a basic API route to retrieve data from the database.
Write database models using SQLAlchemy (or another ORM if preferred).
Add proper error handling for database connection issues.
Test the connection and ensure data is being inserted and retrieved correctly.
Acceptance Criteria
[ ] PostgreSQL database is set up and accessible from the Flask application.
[x] Flask application has the necessary dependencies installed (
psycopg2
,
SQLAlchemy
).
[ ] Flask configuration for PostgreSQL connection is set up (in
config.py
or equivalent).
[ ] A route for inserting data into the database is implemented and functional.
[ ] A route for retrieving data from the database is implemented and functional.
[ ] SQLAlchemy models are created for the required database tables.
[ ] Application gracefully handles errors related to database connections or queries.
[ ] Data can be successfully inserted into and retrieved from the PostgreSQL database via API routes.
[ ] All relevant documentation is updated to include instructions for setting up the PostgreSQL connection.
Task Requirements
psycopg2
,SQLAlchemy
, etc.).Acceptance Criteria
psycopg2
,SQLAlchemy
).config.py
or equivalent).