Commit c9e15d87 authored by Kristian Tan's avatar Kristian Tan

db fix

parent 05eac54a
......@@ -3,7 +3,7 @@ import RPi.GPIO as GPIO
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import create_engine
import os
import daily_usage
from daily_usage import DailyUsage
app = Flask(__name__)
os.environ['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///energyUsage'
......@@ -17,9 +17,7 @@ db.create_all()
engine = create_engine(os.environ['SQLALCHEMY_DATABASE_URI'])
daily_usage.DailyUsage.metadata.createall(engine)
test = daily_usage.DailyUsage("12/11/2019", 5)
test = DailyUsage("12/11/2019", 5)
db.session.add(test)
db.session.commit()
......
......@@ -7,4 +7,4 @@ class DailyUsage(db.Model):
hours = db.Column(db.Integer(120), unique=False)
def __repr__(self):
return '<User %r>' % self.username
\ No newline at end of file
return '<User %r>' % self.id
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment